Display price on add to cart button from the functions.php file in Woocommerce

前端 未结 3 1713
醉酒成梦
醉酒成梦 2020-12-19 19:08

Been trying to find something about this, but the solutions I found so far here do not work.

I need, in the single product page, to display the add to cart button li

3条回答
  •  自闭症患者
    2020-12-19 20:03

    I would suggest you override the WooCommerce template from the child theme, the file name is add-to-cart.php and can be found at woocommerce > loop.

    At the bottom add the following code, it will be displayed only in product single.

    if (is_single()) {
        echo sprintf(
            '%s %s',
            esc_attr__('JUST', 'woocommerce'),
            esc_attr($product->price)
        );
    }
    

提交回复
热议问题