如何重新排序WooCommerce中单个产品页面上显示的内容


How do I reorder the what appears on the single product page in WooCommerce?

我想重新排序WooCommerce上显示的东西。例如,我希望产品摘录位于添加到购物车按钮上方。这是如何改变的?

WordPress WooCommerce单个产品页面默认在添加到购物车按钮上方显示产品摘要或简短描述

假设下面的注释块提供了页面上元素的默认位置或优先级。

  • 产品标题位于位置5
  • 位置10的产品价格等等
  • 您想将产品摘要移动到位置20的"添加到购物车"按钮上方
  • 添加到购物车按钮位置30。

     <?php
       /**
        * woocommerce_single_product_summary hook
        *
        * @hooked woocommerce_template_single_title - 5
        * @hooked woocommerce_template_single_rating - 10
        * @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');
      ?>
    

在此产品摘录中,位于添加到购物车按钮上方。