0
votes

So, I am creating a custom shop with Woocommerce where products are on Woo, but single product page is created as a regular page instead of Woocommerces one template. Is there a way for me to insert somehow only add to cart button related to a certain product to any page? I thought of just using [product_page id="X"] shortcode and using CSS display: none; for all elements except for add to cart button, but that is not a good solution...

1
1. You can use the existing "Add-to-cart" shortcode that you can customized… 2. You can use the existing "Add-to-cart URL" shortcode inside a custom button… 3. You can also simply create your own custom shortcode that will output an add to cart button, just as you want, with the few needed shortcode attributes.LoicTheAztec

1 Answers

1
votes

Hope this will help you. This is the default shortcode in woo commerce to display the add to cart button. This shortcode allows you to show the price and add to cart button of a single product by ID. See the below shortcode.

`array(
 'id' => '99',
 'style' => 'border:4px solid #ccc; padding: 12px;',
 'sku' => 'FOO'
 'style' => 'TRUE'
 'class' => 'CSS-CLASS'

)

[add_to_cart id="99"] `