样品产品,更改价格位置 | WordPress Woocommerce
Sample Product, change location of Price | Wordpress Woocommerce
我正在尝试将所有示例产品的价格位置从当前位置(标题下方更改为大约"add to cart".
如果我用 CSS 来做,那会影响网站的响应能力。
我想在 PHP 上进行此更改,以便它可以影响我现在上传的所有 SAMPLE 产品..
我可以对 PHP 进行任何更改,以便 "SAMPLE Product" 价格始终显示 略高于 "add to cart" 吗?
目前:
我需要的是:
代码在content-single-product.php
<div class="single clearfix row-fluid">
<div class="wrap span6 product-left">
<?php
/**
* woocommerce_show_product_images hook
*
* @hooked woocommerce_show_product_sale_flash - 10
* @hooked woocommerce_show_product_images - 20
*/
do_action( 'woocommerce_before_single_product_summary' );
?>
</div>
<div class="span6">
<div class="product-detail">
<?php
/**
* woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action( 'woocommerce_single_product_summary' );
//echo do_shortcode("[yith_wcwl_add_to_wishlist]");
?>
</div>
</div>
</div>
在下面的代码中,您将覆盖 WooCommerce 挂钩 inclusion/priority 订单。所以价格会包含在优先级为20
的woocommerce_template_single_excerpt
之后
在functions.php
中包含以下代码。
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );
WooCommerce 默认在 单个产品页面 上显示 price between the product title and product description
。
If you’d like to move the price after the content
,您可以通过将以下挂钩添加到主题的 functions.php 文件中来轻松做到这一点:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );
通过将数字从 10 更改为 25,您将价格移至单个摘录(优先级为 20)下方。
WooCommerce templates/content-single-product.php 文件显示单个产品循环的挂钩优先级。
Here you can get WooCommerce Action and Filter Hook
-https://docs.woothemes.com/wc-apidocs/hook-docs.html
我正在尝试将所有示例产品的价格位置从当前位置(标题下方更改为大约"add to cart".
如果我用 CSS 来做,那会影响网站的响应能力。
我想在 PHP 上进行此更改,以便它可以影响我现在上传的所有 SAMPLE 产品..
我可以对 PHP 进行任何更改,以便 "SAMPLE Product" 价格始终显示 略高于 "add to cart" 吗?
目前:
我需要的是:
代码在content-single-product.php
<div class="single clearfix row-fluid">
<div class="wrap span6 product-left">
<?php
/**
* woocommerce_show_product_images hook
*
* @hooked woocommerce_show_product_sale_flash - 10
* @hooked woocommerce_show_product_images - 20
*/
do_action( 'woocommerce_before_single_product_summary' );
?>
</div>
<div class="span6">
<div class="product-detail">
<?php
/**
* woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action( 'woocommerce_single_product_summary' );
//echo do_shortcode("[yith_wcwl_add_to_wishlist]");
?>
</div>
</div>
</div>
在下面的代码中,您将覆盖 WooCommerce 挂钩 inclusion/priority 订单。所以价格会包含在优先级为20
woocommerce_template_single_excerpt
之后
在functions.php
中包含以下代码。
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );
WooCommerce 默认在 单个产品页面 上显示 price between the product title and product description
。
If you’d like to move the price after the content
,您可以通过将以下挂钩添加到主题的 functions.php 文件中来轻松做到这一点:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );
通过将数字从 10 更改为 25,您将价格移至单个摘录(优先级为 20)下方。
WooCommerce templates/content-single-product.php 文件显示单个产品循环的挂钩优先级。
Here you can get WooCommerce Action and Filter Hook -https://docs.woothemes.com/wc-apidocs/hook-docs.html