Hello,
I have been trying to figure out a way to hide the shipping address, shipping options, and removing the shipping line item for orders where the product for sale isn't shippable. Example include a downloadable product, buying the right to accomplish an action or access content on the website. I still have traditional products like hats, t-shirts, thermal nuclear mines, toxic whoopie cushions, etc that require shipping. For now I'm using flat rate shipping instead of calculating based on weight.
Could I?
1) Extend Product Entities
Add a flag (boolean) shippable yes/no
2) Add evaluation rules
On checkout or entering checkout validate all product line items in the cart and if none are shippable:
a) hide shipping address panel
b) Hide shipping step for checkout -> direct customer to review order from checkout start
c) On cart view remove shipping line item entry for good measure
3) Profit?
So can I accomplish items 2a, 2b, and 2c using rules or should I look at writing a custom module to hook into the process? Worst case I'd have to hack the commerce_shipping module to support my particular use case.
Thoughts? Recommendations?
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | commerce_shipping_jump.zip | 1.6 KB | duaelfr |
Comments
Comment #1
mxwitkowski commentedI need this exact functionality as well. Willing to help out on this.
Comment #2
googletorp commentedShipping options is displayed by rules and hidden if no options is available, so you can setup rules to hide/show the options. The shipping line item is only created if a shipping is selected and you can add rules logic or code to delete shipping line items.
Customer profiles is created by commerce so won't comment on that.
Comment #3
emptyvoid commentedHello,
Yes I follow your logic, however if no shipping options exist the shipping panel still appears in the checkout process. Without an attribute or "state" for a given product you won't be able to determine if (once added as a product line item) if it requires shipping or not.
For the moment I'm leveraging the Flat rate shipping module. Which as the name implies provides flat rate shipping options, regardless of the products added to the cart or the number of items added.
So, as I stated before I could added a boolean flag to each product type "shippable" yes/no. Then write a rule when checkout starts, check if the combined list of product line items have a value of "yes". If any have a value of yes the shipping module displays and business logic would run normally. If no, I would use rules or a custom module to hide all shipping panels/options and make sure a shipping line item is not added to the order.
At least, that's the plan; i'll post updates on my progress. If I can accomplish it all using rules and a few fields on each product type I'll post an export of the rules I have built. Honestly I would expect that the shipping modules would cover this use case. Not all products are shippable.
Anywho, wish me luck.
Comment #4
toppen56 commentedI'll be interested to hear how you handle this. I was searching for a solution to this issue.
Comment #5
poniesI've just run into this myself. Luck!
Comment #6
emptyvoid commentedAnnoying RANT TIME!
So I only see one rules condition as it pertains to checkout "Checkout is complete" how can I trigger evaluation on cart load?
on Checkout load during pre-render of the checkout page that lists all of the panels (shipping being one of the panels I'd like to hide)?
How do I remove the "Shipping" page from the checkout process if there is no condition nor action to do so?
I'm still working through this (which most likely points to a custom module) and attempt to accomplish it using Rules as you recommended. But after close inspection that direction seems a little too "simplified" of an answer to actually help me.
So I've changed the status as this issue is not resolved... and if I do solve it I am going to attach the exported rules (or custom module) I used to actually solve the problem. I just hope such features can be rolled into the default install of the module. It would be great to have several disabled rules added to the shipping module that users can enable based on their particular business case needs.
Comment #7
emptyvoid commentedFollow up of my progress thus far. I have a boolean "shippable" as a filter when evaluating product line items it helps automatically determining if an order has any shippable products.
Second I followed the recommendations of the free online training from Commerce Guys about using "weight" based products and conditionally calculating the shipping price by quantity and weight.
http://vimeo.com/33838479
Next I added evaluation rules for the standard shipping "placeholder" for my shipping method. I added an evaluation that would totally remove the shipping method as an option is no products were shippable. Sure enough the shipping method hides, but what doesn't hide is the Shipping Page in the Checkout Workflow. :(
Nevermind I will also need to write a hook to hide the shipping address panel of the first check out page when shipping is not required. I hope, I can evaluate the order line item products from the first page.
I may have to add a custom validation hook to stomp the shipping panel to force it to hide from the checkout workflow.
Comment #8
valante commentedHi,
I'm also in dire need of this functionality. Here's how I see it:
1. Every product must have a checkbox field, whether it's shippable or not
2. Possible to define default based on product-type, to save time
3. On checkout, if no products in the cart are shippable, do not display the shipping profile and the shipping methods
I believe this is a need of many people who sell mixed digital and tangible goods.
I'm willing to fund this at $200. Will that do? Will anyone else join me in offering a bounty?
Comment #9
valante commentedAny takers on the above bounty?
Comment #10
FAAREIA commentedmmmm, where are the followers??? I thinks that this issue is very importante for real commerce proyects. Please follow if you are interested. it can't be only 7 followers!
Comment #11
emptyvoid commentedUpdate, so as I have described I have resulted in using the physical product, weight field and boolean "Is Shippable?" on every product type in the store.
Next I added several rules both in the cart, shipping methods, and checkout actions.
Because of time, I have put the effort to actually hide the shipping elements in the GUI. But I hope to have time (we're talking months here) to build a module to override the display of the shipping panel and shipping page in the checkout process.
Based on an initial review of the code for both the panel and pages in the checkout process I don't see an attribute or hook to alter the fields (yet). But that may be where I will start my research, once a hook_alter exists I could then create events, conditions, and actions for Rules.
Comment #12
FAAREIA commentedHi emptyvoid, can you explain me a little more how did you manage to not load Shipping form???
I'm trying something with rules but i can't see any option to do so. Plus, i do not have weights. I just wanna to let the user choose on Checkout:Checkout if he need Shipping or not.
Thanks for all
Comment #13
pixhail commentedHi Emtyvoid,
I have coded a custom module, which is as per your needs.
In this method, there will be a boolean value, in the form of a check box, which will be for items shippable or not.
If not shippable, during checkout, no shipping info pane will be shown. But if shippable, shipping info pane will be shown.
If you want this module, let me know.
Comment #14
pixhail commentedGuys, i have given the solution to valante. Tal can you pls confirm?
Comment #15
FAAREIA commentedIt's good to know there is a solution to this issue, but i think it's only the first step.
For example:
All my products are shippable, but i don't want the items to be shipped because i will go to the store and get my products. In this case, items are shippable but user choose "not to ship".
There could be a second boolean value on checkout:checkout to apply this use case. Or a rule checking the value and enableing or disabling a panel could be nice two.
This are simply some ideas i thought about it,
Greetings
Comment #16
pixhail commentedHi Stakcreativa,
I can add this small thing in my module, if you are interested.
Thanks
Comment #17
pixhail commentedHi Stakcreativa,
I can add this small thing in my module, if you are interested.
Thanks
Comment #18
valante commentedI did just get this add-on module from pixhail, no hacking, works great.
Comment #19
FAAREIA commentedHi pixhail, i will really appreciate if you can add my use case to your module. Many thanks for asking and for all the work you have done. =)
Greetings.
Comment #20
pixhail commentedHow much , you will pay for that?
Comment #21
FAAREIA commentedmmmmm, i can't pay you since i do not have credit card but you can ask me something to css or design if you want =). Like a trade.
Comment #22
pixhail commentedi am sorry, design stuffs etc, i do my self.
You don't have paypal too?
Comment #23
FAAREIA commentedsry pixhail, i'm from Argentina, i never used Paypal (it don't have our currency). Gonna be on other life then. Thanks anyway.
Comment #24
googletorp commented@pixhail if you want to sell code, please take it somewhere else instead of using the issue queue for that stuff.
Comment #25
duaelfrI acheived to jump over shipping panel with rules so if your shipping rates does not depend on the address, it could be interesting for you (just ask).
In my case, I have to let my shipping address form out of the shipping panel so I am a bit stuck with this issue.
Comment #26
bradhawkins commented@DuaelFr that sounds like it would work for my situation, can you export and post your rule? Or at least a step by step overview?
Comment #27
duaelfrOk so you will need Commerce Physical Product with the following patch #1344962-17: Add some helpful rules conditions (Comment #17)
Then you will find a module in the attachment which enables two rules to jump over the shipping pane.
Comment #28
bradhawkins commentedThanks DuaelFr! Works perfectly!
But I should note that your patch in #1344962: Add some helpful rules conditions doesn't seem to have the new condition "commerce_physical_rules_order_is_shippable" that you mentioned. Its not at all a problem for me, (I've only got 1 shippable item, so I can easily setup up a condition to check for that product's sku) but I thought I would mention it because you might want to double check your patch to make sure all your work got included.
Thanks again for your help!
Comment #29
duaelfrOMG you are right !
Entire commit is here.
I provided a new patch including the missing file.
Thank you very much :)
Comment #30
bradhawkins commentedCool! Works much better than my single product SKU hack - and is scalable :)
Merci!
Comment #31
muhammad.tanweer commentedHello DuaelFr,
Thanks for the great patch. As mentioned, it works for several people, however, I applied the latest complete patch to commerce_physical module, but still I am unable to see the rules here : http://mywebsite.com/admin/config/workflow/rules
I even uninstalled and re-installed the module, cleared cache, did everything that I understood should work but still no clue. I am stuck, can you please give me a few lines of quick help? Would be appreciated.
Thanks
Comment #32
cherrysuede commentedHey DuaelFr
Question for you - i have installed the patch - I see the condition in rules but when i install the shipping jump module - i don;t see the rules that you talk about
Have I missed something?
Thanks!
Comment #33
duaelfrI don't know why it is not working on your installation.
I theory, rules may be shown in the main Rules screen even if their components are not found.
Try to add a
file[] = commerce_shipping_jump.rules_default.incin the info file and to clear cache to see if it changes something.If not, ask bradhawkins how he acheived this :)
Comment #34
poniesNot sure if it was user error, but commerce_shipping_jump didn't apply the rules when I enabled it. I manually entered the rules and they worked like a charm. Now to hide and not require the shipping information.
Comment #35
muhammad.tanweer commentedHi ponies,
Can you please tell me the exact rules that you created? I have spent a lot of time tweaking the commerce shipping jump module here and there but had no luck so far. Sorry if its an easy question but I am not very good at rules so it would be helpful if you give me the steps here.
Thanks
Comment #36
ponies@muhammad.tanweer: Importing these did the trick for me.
Comment #37
muhammad.tanweer commentedPonies,
GREAT. That worked. It really was a pain as I spent a lot of time on it. Thanks a million.
Muhammad.
Comment #38
torgospizzaIs it possible we could get the patched version of the module, along with the code/rules posted above, into the proper version of Commerce Shipping? It seems like this is critical, vital functionality to hybrid stores that sell both physical and digital products.
Comment #39
anicode commentedThanks DuaelFr for the patch. Although the jump happens , the shipping info on the review pane still remains. is there a way to hide this. Also the progress block has the shipping tab on it.
Any ideas to hide these so that the user does not get confused.
Comment #40
duaelfrI did not found any solution the last time I tried to properly hide all the shipping stuff, sorry...
Comment #41
brephraim commentedI'm still looking into disabling the shipping page so it won't show on the checkout progress bar, but as far as the review page goes, this code should take care of it:
Comment #42
brephraim commentedGot the shipping page disabled on the progress bar.
First, you need the patch here http://drupal.org/node/1508472#comment-5806364, but before applying, make the correction noted here http://drupal.org/node/1508472#comment-6645716. (I actually don't know if that patch still applies correctly, I changed the code manually, it's only a few lines.)
Then you can add the following function to your custom module:
Comment #43
shaneonabike commentedI agree these rules are pretty great... I also was not able to use the module as is and had to manually upload them using the import feature :)
Kudos for posting that!
Comment #44
shaneonabike commentedAlso I found this code in how to enable/disable panels which I will use for Shipping I hope it aids others - http://digital54.com/drupal-commerce/dependent-shipping
Comment #45
torgospizzaCross-posting between this and #1759488: Need To Bypass Shipping Page If No Shippable Products On The Order:
I believe the Commerce Rules Extra module may also hold some value to those of us (like myself) who are looking to disable or hide shipping panes when only non-shippable products are ordered.
Comment #46
torgospizzaAn update: the solutions in #41 and $42, as well as the Commerce Rules Extra module, rely on disabling the Shipping pane(s). Unfortunately this is a global value, and affects the pane's status in the Administration section as well. Therefore I don't think these are workable solutions, at least yet. There is a thread at #1122386: Allow rules to control which panes are visible during checkout that discusses some of these problems, and it seems the root of the solution will be a deeper Commerce fix which allows Rules to adjust the visibility of a pane, not actually disabling it.
EDIT: Upon closer inspection, #41 and #42 seem better than the Commerce Rules Extra module, as the module updates global variable values, as opposed to the above solutions which use alter() hooks to update the pane for a particular order.
Comment #47
headbank commentedHi, this thread has helped me greatly with implementing a shop with mixed shippable/non-shippable items. Thanks to those involved.
(EDITED to remove a non-applicable support query.)
Comment #48
deggertsen commentedTo simplify the instructions given in this thread, I have compiled them all in this post. Following these instructions should get it so that when non-shippable products (products without width or dimensions) are the only thing in your cart, it will hide the shipping options including on the checkout progress bar if you are using https://drupal.org/project/commerce_checkout_progress.
First, you need the patch here https://drupal.org/node/1508472#comment-7640851. Applies against the latest dev as of July 12 2013.
Then you need to insert the following code into a custom module (replacing "mymodule" with the name of your custom module):
Thanks @brephraim!
Apply the latest patch here: #1344962: Add some helpful rules conditions
Then make sure you have rules setup similar to these, or simply import these rules. Based on the module posted in #27.
Thanks for everyone in this thread! It would be nice to not have to use a custom module but to instead have a patch written to include all of this, but for now this works...
Comment #49
rbrownellHow did you configure a rule to hide a Shipping Service? I keep Googleing this to try to figure it out but all I keep seeing is this issue.
EDIT: It appears that the only way to disable or hide a Shipping Service is via the initial rules that makes the shipping service. I used the Conditional Rules module to create elaborate rules that would then feed into the Conditions of a Shipping Service component rule. As challenging as it was, I would have to say the amount I've learned about rules in the past few days is invaluable. To any people who are trying to do complex shipping rules, keep at it and check out the module I mentioned. There are also a few tutorials out there on how to do specific things, make sure that you pay attention as opposed to blindly following the instructions because you will learn lot.
Comment #50
heddnSee #1461726: Notice Errors on commerce_checkout_commerce_order_status_info add sane defaults
I've implemented using using
hook_commerce_checkout_router(). This removes the shipping option from the navigation.Comment #51
heddnThis picks up the shipping address pane as well. I've refactored the common code:
Comment #52
apmsooner commentedThis can be done pretty easily with commerce_rules_extra module. I just created a taxonomy called "product attributes" and added a term called "Shippable". I assigned that tag to all products that were shippable and then created a rule to check for that tag.
Comment #53
snaderi commentedhello friends!I have problem with this modules!
thats disable allways my shipping pane!
when wieght is 0 or empty shipping disable and when wieght is 10kg shippable pane are disable!please help me!?tanks!
Comment #54
apmsooner commented@snaderi, why not try my solution in #52? I have it working in production environment for several months now... I even provided you the sample rule to modify for your own environment.
Comment #55
snaderi commentedtanks for your reply but when import #52'rules recive this error:
Integrity check for the imported configuration failed. Error message: Data selector <em class="placeholder">commerce-order</em> for parameter <em class="placeholder">order</em> is invalid..please help me!
Comment #56
apmsooner commentedIt's looking for a term id that doesn't exist on your environment. Just change that in the rule to a term id that does exist and it should be fine.
Comment #57
snaderi commentedhow I can find term id!?
'vid' in "vocabulary taxonomy" table in my database are equal 11!I modify that but again I receive that error!
Comment #58
snaderi commentedwow!!tanks very much for your help!thats work by update Rules!!
Comment #59
snaderi commented+1 for #52
Comment #60
MD3 commentedThanks for @apmsooner for getting me on the right track! Using Commerce Rules Extra is the way to go!
When I tried to import your rule it gave me an SQL integrity error, so I created the rule from scratch. Another way to do this for those of you facing a similar situation is to look at the type of products in the cart. If you have
giftcardproducts, here's a rule to get you started:If the rule fails or you have another type of non-shippable product, create a new rule using the following steps:
Commerce Checkout -> Commerce checkout paneCommerce Order -> Order contains products of particular product types. Select the type of non-shippable productsCommerce Order -> Total product of type quantity comparison. Select the type of non-shippable product. Exclude:Check (true). Operator:=. Quantity:0.AndCommerce Checkout->Change pane properties. Value:Pane to be changed. Page to move to:<do not change>. Enabled:Unchecked (false).Review order.Comment #61
ryanfc78 commentedI am getting the following error on the Checkout page when I try #60
What am I doing wrong?
Rule:
Comment #62
pwsherman commentedryanfc78 did you figure it out? The AND goes inbetween the first two conditions.
#60 Works great! Thanks MD3!
Comment #63
mr.andrey commentedComment #64
mr.andrey commentedComment #65
mr.andrey commentedBesides disabling shipping pane, I also wanted to skip the shipping page. Here are the rules to do that.
"membership_shippable" is the shippable product, all others are not. Change this to whatever you need in both rules.
Commerce 7.x-1.10
Commerce Rules Extra 7.x-2.1-beta4
PHP Input enabled
DISABLE SHIPPING PANE RULE:
DISABLE SHIPPING PAGE RULE:
Cheers,
Andrey.
Comment #66
donbon commentedHi Andrey, thanks so much for sharing your code, it has been very helpful. I just had one question for the Disabling shipping page rule, where does the component "component_rules_order_status_checkout_review" come from? I don't seem to have that one. Is that a custom one you made, or is it from a module? Thanks again for posting your code, I'm currently using the checkout pane and it works perfectly! :)
Comment #67
mr.andrey commentedHi Mattbus,
I'm not sure about that one. Here's a list of all the commerce modules I have installed:
commerce
commerce_add_to_cart_confirmation
commerce_addressbook
commerce_authnet
commerce_backoffice
commerce_cardonfile
commerce_checkout_progress
commerce_checkout_redirect
commerce_custom_product
commerce_discount
commerce_flat_rate
commerce_license
commerce_message
commerce_recurring
commerce_rules_extra
commerce_shipping
commerce_stripe
commerce_subscription
commerce_webform
I hope this helps.
Andrey.
Comment #68
mr.andrey commentedI ended up consolidating all the billing and shipping info onto the checkout page, so there's less clicking. The shipping page gets disabled automatically once it has no panes.
This is the rule I'm using to disable both the Shipping Info and Shipping Services on orders with no shippable products:
Cheers,
Andrey.
Comment #69
googletorp commented