This code enables you to add a note on the cart page to highlight which products cannot be shipped. The code checks if the product contains a specific shipping class and displays text so the customer knows it cannot be delivered.
Here’s an example of how you can display text within the cart item data for products assigned the No Shipping class :
Usage
There’s 2 steps :
- Create a new shipping class and assign the no shipping class to the products you don’t want shipped. Make sure the slug for your shipping class exactly matches no-shipping as seen in the following slide images.
- Copy and paste the PHP code from above to the end of your child theme functions file or custom code snippets/functionality plugin.