Home / eCommerce / Allow free shipping for EDD Simple Shipping
Duplicate Snippet

Embed Snippet on Your Site

Allow free shipping for EDD Simple Shipping

Enable free shipping for a specific download, or specific download/price ID combination. This will ensure that a shipping address is required at checkout, but no shipping fee will be applied to the order.

Code Preview
php
<?php
<?php
/**
 * Set the price has shipping to true for a specific item.
 *
 * @param bool $has_shipping Whether the price has shipping.
 * @param int  $item_id      The item ID.
 * @param int  $price_id     The price ID.
 * @return bool
 */
function eddwp_price_has_shipping( $has_shipping, $item_id, $price_id ) {
	$item_with_free_shipping = 1234;
	return (int) $item_id === $item_with_free_shipping ? true : $has_shipping;
}
add_filter( 'edd_simple_shipping_price_has_shipping', 'eddwp_price_has_shipping', 10, 3 );

Comments

Add a Comment