For variable product, it’s not the product that you need to test but the variations :
add_action( 'woocommerce_before_add_to_cart_button' , function () {
global $product;
$downloadable = FALSE;
if ("simple" === $product->get_type()) {
$downloadable = $product->is_downloadable();
} elseif ("variable" === $product->get_type()) {
$variations = $product->get_available_variations();
foreach ($variations as $variation) {
if ($variation["is_downloadable"]) {
$downloadable = TRUE;
break;
}
}
}
if ($downloadable) {
echo '<p>Please note: a link to your downloadable product will be
available on the purchase confirmation page.</p>';
}
});
Related Posts:
- Order by rating not works in wp_query
- Woocommerce: show default variation price is products list?
- Woocommerce checkout fields on the same line
- display available size on hover, in woocommerce shop page [closed]
- How to Add Product Variation with Multiple Images via WooCommerce REST API
- WooCommerce: Email Notifications
- How do you add custom metadata to WooCommerce orders? Specifically a second external order ID
- WooCommerce: Adding Order Item Meta Data That’s Hidden
- Hide tabs on woocommerce product editor for user role
- Woocommerce add_to_cart non-register visitor not working
- Redirect user after login through woocommerce login page to page with his/her username?
- WooCommerce restore stock on order cancel
- Authenticate user into wordpress via 3rd party system, both with the same domain
- WordPress select field – show current value?
- show shop instead of 404 page for missing products
- if statement for search results
- Woocommerce exclude specific categories products from related products
- Woocommerce: Prevent sending of email when order is “Completed”
- Apply a discount percentage to regular price WooCommerce by function
- Add sub subpage endpoint in woocommerce
- Edit WooCommerce product content based on category
- Server-Based CRON Job
- How to incluide custom field in WooCommerce email using placeholder
- Woocommerce: Can’t put items in cart in iframe and on iphone
- Display products by category in Woocommerce cart page?
- Checkout is blocked with blockUI when using action woocommerce_cart_calculate_fees
- Checkout form looks terrible [closed]
- How to upload multiple image using wp_insert_post
- How can i manage total price in checkout page? [closed]
- In WooCommerce product archive, how can you also set the quantity to be added to cart by typing, instead of just by using +/-?
- WooCommerce product category permalinks
- How to do string attachment with wp_mail
- Can’t show most recent comment on top with wp_list_comments() for WooCommerce reviews
- WooCommerce order complete email logic
- WooCommerce Displaying Price With & Without TAX [closed]
- API returns blank response after installing & uninstalling WP-rest-api plugin
- Tried to create a user role that can only edit user information, but my test account cannot view the dashboard. What am I missing?
- Filtering variable WooCommerce products by stock level using meta_query
- How can I run a multi language WordPress site in two folders in one install? [closed]
- Dropdown menu not displaying WordPress
- Adding a custom Shipping methods field to an order
- WooCommerce – Create multiple product tags via rest api endpoint
- WooCommerce which roles and capabilities control user login re-direct to Woo Account Page?
- how do i remove a woo-commerce widget?
- How can I convert woocommerce checkout fields in capital letters
- Conditional action hook
- Sending Email upon registration
- Order by date on category dynamically – Woocommerce
- Woocomnerce Limit Purchase value before proceed checkout
- Add to cart – button should be disabled
- Migrating data from Woocommerce to another webapp
- How To Customize The Product Page Template for a WooCommerce Custom Product Type Plugin [closed]
- Hide Add to Cart button on woocommerce Product description page of a particular product
- Options to develop a non-ecommerce catalog?
- wp_set_object_terms setting only first id from array
- I need to export all products and images but I don’t know which table the images are in
- Add only sku to product url woocoomerce
- What is better way to sync wp multisite woocommerce products
- Remove required from a custom field created from WooCommerce Checkout Field Editor plugin
- How to change status of woocommerce orders when post status is changed
- manage_shop_order_posts_custom_column() hook is Not working In Functions.php file in my WordPress active theme
- Purchase/order statistics plugin for viewing per payment menthod?
- Displaying Woocommerce Product Attributes on single product page
- WooCommerce – Child Category wont show, but Parent does
- How to hide a random text with a div tag using a class on product pages with a specific tag
- Missing variable options on add to cart form
- Woocommerce digital download not working – database error Cannot add or update a child row: a foreign key constraint fails [closed]
- when product out of stock single page show button notify woo-commerce
- WooCommerce , Auto cancel orders status from processing after X days
- Add username and password section in WooCommerce’s my account page
- Recently viewed products – Order by viewed
- How can i add product Accessories from front-end using custom php form?
- How to save order item custom attributes save into custom table
- Manually create an order with a product ID woocommerce
- How to change user role after login?
- WooCommerce free shipping twice a week
- Product overlapping header
- How to import products to Woo Commerce given that WP All Import keeps timing out
- WooCommerce subscriptions give option of manual renewal on checkout [closed]
- Change order status after checkout
- Is it safe to update an old site after backing it up and activating a child theme?
- Click Count on Download a File
- How to add coupon expiry date into the followup emails?
- Disable Woocommerce main shop page, but not the product category archive pages
- Custom Woocommerce checkout filed yields a Json error when validating [closed]
- access Woo commerce | WordPress methods externally
- How to store ACF from product in user_meta?
- Woocommerce set single city to sell to
- Trying to link to a custom css file in a new folder
- eCommerce solution doesn’t want to display its shortcodes or any content where it’s set to [closed]
- Woocommerce hidden fields with meta keys and values. how?
- How do I make a diagonal strikethrough on wordpress? [closed]
- Woocommerce – Remove ‘Buy Product’ Button from shop page [closed]
- Add woocommerce.css in template?
- Trying query woocommerce product order by menu order and stock status
- editing product page template – getting template for related products not working
- Woocommerce | I want to the button ‘Add to Cart’ on the (all) product-page changed by just ‘open product’ button
- Adding line breaks in WooCommerce order processing emails
- Add second price option based on payment method at cart item price
- Woocommerce backend sorting product drag drop by menu_order to date