WooCommerce display price on add to cart button

后端 未结 3 1434
走了就别回头了
走了就别回头了 2020-12-19 20:58

I\'m trying to add the price to the add to cart button in the loop.

[100$ Add to cart] instead of [Add to cart]

add_to_cart.php template:

3条回答
  •  轮回少年
    2020-12-19 21:42

    WooCommerce 3.1.0 updated the Functions for Add to Cart Button

    apply_filters( 'woocommerce_loop_add_to_cart_link',
    sprintf( '
  • ', esc_url( $product->add_to_cart_url() ), esc_attr( isset( $quantity ) ? $quantity : 1 ), esc_attr( $product->get_id() ), esc_attr( $product->get_sku() ), esc_attr( isset( $class ) ? $class : 'button' ), esc_html( $product->add_to_cart_text() ) ), $product );

提交回复
热议问题