Some products only pickup
-
Hello,
I have some products that only can pickup.
I found this code snippet:
// Force pickup as a shipping option if one or more products in the catalog is marked as pickup only. // To do this, add a shipping class with the slug 'pickup-only' then set products with that class as required. // Add this script to your theme's functions.php or similar. function hideShippingWhenPickupRequired($rates, $package) { //verzendklasse 'Ophalen (pickup-only)' foreach ($package['contents'] as $item) { $product = $item['data']; $shippingClass = $product->get_shipping_class(); if ('pickup-only' === $shippingClass) { // The cart requires pickup return array( 'local_pickup' => $rates['local_pickup'], ); } } return $rates; } add_filter('woocommerce_package_rates', 'hideShippingWhenPickupRequired', 10, 2);
It has one problem. It hides all the shipping rates.
Who can help me solve this issue, that the client can buy the product and show only ‘local pickup shipping’?regards,
Christophe
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Some products only pickup’ is closed to new replies.