Reputation:
How can I link a simple download button act like a cart button ? If I have to make a user download a 2$ song, instead of directly downloading it, it should add that song to the woo commerce cart page.
Upvotes: 0
Views: 1031
Reputation: 1300
Add this to your theme's functions.php
to change "Add to Cart" to "Download"
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_single_add_to_cart_text' );
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_product_add_to_cart_text' );
function woo_custom_single_add_to_cart_text() {
return __( 'Download', 'woocommerce' );
}
EDIT: If you want a custom Add To Cart or Download button, add the following link to that button
http://your-domain.com/?add_to_cart=5
Where your-domain
is your site domain and 5
is your product/audio ID.
Upvotes: 0
Reputation: 1433
In woocommerce add your product. And in the product edit page there is a checkbox called 'downloadable'. Tick that box. Then it will become a downloadable product. That item will be added to cart.
Hope this helps.
Upvotes: 1