php 在Shopkeeper主题中为XL WooCommerce Sales Trigger插件更改WooCommerce单一产品位置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 在Shopkeeper主题中为XL WooCommerce Sales Trigger插件更改WooCommerce单一产品位置相关的知识,希望对你有一定的参考价值。

/**
 * Add This whole code in working theme functions.php inside php tag to alter woocommerce native positions
 * Theme: https://themeforest.net/item/shopkeeper-ecommerce-wp-theme-for-woocommerce/9553045
 * XL WooCommerce Sales Trigger Class Instance
 */
add_action('wp', 'shokeeper_wcst_modify_positions', 99);

function shokeeper_wcst_modify_positions() {
    if (class_exists('WCST_Core')) {
        $wcst_plugin_instance = WCST_Core::get_instance();

        // removing duplicate price
        remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);

        // removing below price and below add to cart buttton action hook of plugin    
        remove_action('woocommerce_single_product_summary', array($wcst_plugin_instance, 'wcst_position_above_title'), 2.2);
        remove_action('woocommerce_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_title'), 9.2);
        remove_action('woocommerce_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_review'), 11);
        remove_action('woocommerce_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_price'), 17.2);
        remove_action('woocommerce_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_short_desc'), 21.2);
        remove_action('woocommerce_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_add_cart'), 39.2);
        remove_action('woocommerce_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_meta'), 41.2);
        remove_action('woocommerce_after_single_product_summary', array($wcst_plugin_instance, 'wcst_position_above_tab_area'), 9.8);
        remove_action('woocommerce_after_single_product_summary', array($wcst_plugin_instance, 'wcst_position_above_upsell'), 14.2);
        remove_action('woocommerce_after_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_upsell'), 19.2);
        remove_action('woocommerce_after_single_product_summary', array($wcst_plugin_instance, 'wcst_position_below_related_products'), 21.2);

        // hooking below functions for 'shopkeeper' theme
        add_action('woocommerce_single_product_summary_single_title', array($wcst_plugin_instance, 'wcst_position_above_title'), 1);
        add_action('woocommerce_single_product_summary_single_title', array($wcst_plugin_instance, 'wcst_position_below_title'), 9);
        add_action('woocommerce_single_product_summary_single_title', array($wcst_plugin_instance, 'wcst_position_below_review'), 11);
        add_action('woocommerce_single_product_summary_single_price', array($wcst_plugin_instance, 'wcst_position_below_price'), 19);
        add_action('woocommerce_single_product_summary_single_excerpt', array($wcst_plugin_instance, 'wcst_position_below_short_desc'), 21);
        add_action('woocommerce_single_product_summary_single_add_to_cart', array($wcst_plugin_instance, 'wcst_position_below_add_cart'), 31);
        add_action('woocommerce_single_product_summary_single_meta', array($wcst_plugin_instance, 'wcst_position_below_meta'), 41);
        add_action('woocommerce_after_single_product_summary_data_tabs', array($wcst_plugin_instance, 'wcst_position_above_tab_area'), 10);
        add_action('woocommerce_after_single_product_summary_related_products', array($wcst_plugin_instance, 'wcst_position_below_related_products'), 21);
    }
}

以上是关于php 在Shopkeeper主题中为XL WooCommerce Sales Trigger插件更改WooCommerce单一产品位置的主要内容,如果未能解决你的问题,请参考以下文章

php [WooCommerce Core]每行更改产品数量(Woo主题)

php [WooCommerce Core]每行更改产品数量(Woo主题)

php [WooCommerce Core]删除Woo主题中的面包屑(非店面)

php [WooCommerce Core]删除Woo主题中的面包屑(非店面)

php [WooCommerce Core]删除Woo主题中的面包屑(非店面)

php [WooCommerce Core]删除WooCommerce页面上的面包屑(On Woo主题)