如何修改woocommerce_before_cart动作 [英] How to modify woocommerce_before_cart action
问题描述
我正在尝试将我的 woocommerce 购物车模板显示为完整的 12 列布局.
现有布局使用引导程序的 col-sm-8 列.我需要将其更改为 col-sm-12.
<div class="page-header"><h1>购物车</h1>
<div class="woocommerce">...</div><div class="woocommerce-info">...</div><div class="cart-collaterals">//运输代码等
</main>
我查看了相关的 woo-templates 此处显示,并复制了购物车.php 模板到我的主题来覆盖.但是,看起来我需要修改 woocommerce_before_cart
操作以更改 布局并插入
col-sm-12
类.我在这个 woocommerce 页面上找到了相关操作.
我可以从 cart.php
模板中看到在 元素之前调用的操作,如下所示:
全球$woocommerce;wc_print_notices();do_action('woocommerce_before_cart');?><form action="<?php echo esc_url(WC()->cart->get_cart_url()); ?>"方法=发布"><?php do_action('woocommerce_before_cart_table');?><table class="shop_table cart" cellspacing="0">在此处输入代码
我是 php 新手,我的问题是如何修改此操作的输出,以便将布局更改为 12 列?
Woocommerce 将 cart.php 中的内容插入到主题根目录下的 page.php 中.:)
I'm trying to make my woocommerce cart template display as a full 12 column layout.
The existing layout is using bootstrap's col-sm-8 column. I need to change it to col-sm-12.
<main class="main col-sm-8" role="main">
<div class="page-header">
<h1>Cart</h1>
</div>
<div class="woocommerce">...</div>
<div class="woocommerce-info">...</div>
<div class="cart-collaterals">
// shipping code etc.
</div>
</main>
I checked out the relevant woo-templates shown here, and copied the cart.php template into my theme to override. However, it looks like I need to modify the woocommerce_before_cart
action to change the <main>
layout and insert the col-sm-12
class. I found the relevant actions on this woocommerce page.
I can see from the cart.php
template the action called before the <form>
element as shown below:
global $woocommerce;
wc_print_notices();
do_action( 'woocommerce_before_cart' ); ?>
<form action="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" method="post">
<?php do_action( 'woocommerce_before_cart_table' ); ?>
<table class="shop_table cart" cellspacing="0">enter code here
I'm new to php, my question is how do I modify the output of this action so I can change the layout to 12 columns?
Woocommerce inserts the content in cart.php into page.php in the root of your theme. :)
这篇关于如何修改woocommerce_before_cart动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!