How to add a product sample button using shortcode on a custom product page in WooCommerce
The Product Sample plugin allows you to display a sample request button on product pages using a shortcode.
This is especially useful when you are using custom product templates built with page builders like Elementor, Beaver Builder, or WPBakery.
In The Article
Benefits
- Works with custom product templates
- Easy integration with page builders
- Flexible button placement anywhere on the page
- Improves customer experience by offering samples directly
How to Add Product Sample Button Using Shortcode
Follow these steps to display the sample button on a custom product page:
- Go to your product page template (Elementor, Beaver Builder, etc.)
- Add a Shortcode widget/block to the desired location
- Enter the following shortcode:
[dsfps_sample_button]
- Update or publish the page
Example Use Cases
- Add a sample button below the product description
- Show the sample option near the Add to Cart button
- Place the sample button in a custom product layout
- Offer samples only on specific product templates
Conclusion
Using the shortcode method gives you full control over where the sample button appears. This is ideal for stores using custom layouts or page builders.