样品产品,更改价格位置 |WordPress Woocommerce [英] Sample Product, change location of Price | Wordpress Woocommerce

查看:39
本文介绍了样品产品,更改价格位置 |WordPress Woocommerce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将所有示例产品的价格位置从标题下方的当前位置更改为添加到购物车".
如果我用 CSS 来做,就会影响网站的响应能力.
我想在 PHP 上进行此更改,以便它可以影响我现在上传的所有 SAMPLE 产品..
我可以对 PHP 进行任何更改,以便样品产品"价格始终显示在正上方添加到购物车"?

目前:

我需要的是:

content-single-product.php 中的代码

<div class="wrap span6 product-left"><?php/*** woocommerce_show_product_images 钩子** @hooked woocommerce_show_product_sale_flash - 10* @hooked woocommerce_show_product_images - 20*/do_action('woocommerce_before_single_product_summary');?>

<div class="span6"><div class="product-detail"><?php/*** woocommerce_single_product_summary 钩子** @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]");?>

解决方案

在下面的代码中,您将覆盖 WooCommerce 挂钩包含/优先级顺序.所以价格将包含在 woocommerce_template_single_excerpt 之后,优先级值为 20

functions.php 中包含以下代码.

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );add_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 25);

I am trying to change the location of Price of all sample Products from the current location, which is below the title to just about "add to cart".
If i do it with CSS, that is affecting the responsiveness of the website.
i want to make this change on a PHP, so that it can impact all the SAMPLE products which i upload now on..
can i make any changes on the PHP so that the "SAMPLE Product" Price always shows up just above "add to cart" ?

at present:

what i need is:

the code in 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>

解决方案

In the below code, you are overwriting the WooCommerce hook inclusion/priority order. So the price will be included after woocommerce_template_single_excerpt which has a priority value of 20

Include the following code in functions.php.

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );

add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );

这篇关于样品产品,更改价格位置 |WordPress Woocommerce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
PHP最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆