3
Answers
Vote up!
0
Vote down!

Flow Chart of Drupal Commerce Needed

I'm setting up the taxing system for a client and some products are taxable while others are not. I've created a field for this to each product. However, I'm unsure as to how I would add taxes within the commerce checkout system. I know how to do it otherwise, but commerce entities have me all confused.

Where I'm running into the issue is that some items in the same cart will need to have tax applied while others will not.

Is there a flow chart that can help me to understand how commerce line items(commerce-line-item) and orders are set up in relation to products? Thanks in advance!

Asked by: therealjjj77
on January 15, 2014

Comments

Clarification: Sometimes the billing client is a b2b sale of an item for resale and in such a case, they can't charge sales tax on that item. So I'm trying to set the tax component to calculate this. Here's my approach:

Condition: address:state-field=MN

Action: Add a variable: Type: Integer, Name: variable_added

Loop: Parameter: List[commerce-line-item:order:commerce line items], List item: (list_item)

Conditional

If: Entity has field, Parameter: list_item, Field: field_taxable

Conditional

If: data comparison, parameter:list_item:field_taxable equals 1(yes)

Action: Calculate a value, list_item:total:amount * .06875 = item_tax

Action: Calculate a value, variable_added + item_tax:amount = total_tax

Action: Set data value: Set variable_added to equal total_tax

Apply a tax rate to a line item: Parameter:commerce-line-item, Tax rate: Sales Tax Minnesota, Provided variables: applied_tax

Set a data value: Set applied_tax:amount to variable_added

The Issue: When I try to make the second if statement, I can't find the field that I just called in. Any help would be appreciated. Thank you.

- therealjjj77 on January 16, 2014

3 Answers

Vote up!
0
Vote down!

So I figured out the way to accomplish what I needed.

First, I went to Line Item Types:Product and added a boolean called "Add Tax at Checkout".

Second, I went to every product type and added the same field.

Third, created a rule that reacted after a product is added to the cart. It required three conditions: 1. that the product had the field "Add Tax at Checkout". 2. that the commerce line item had the field "Add Tax at Checkout". 3. That the field of the product was checked.
Finally, created an action in the rule to set the value for the commerce-line-item: "Add Tax at Checkout" to the checked value.

Fourth, in the tax rules, I clicked on the component and included two conditions, that the commerce-line-item had the field "add Tax at Checkout" and that the field was set as checked.

Working now!

Answer by: therealjjj77
Posted: Jan 20, 2014
Vote up!
0
Vote down!

Hi, add an "Applicable TAX" field (boolen) to your product and then via RULES modify TAX rules to check (condition) if this field is setted.

Try this.

M.

Answer by: ziobudda
Posted: Jan 17, 2014

Comments

Have tried adding this to the line item type field as well as the product variation type fields but my problem happens when I try to validate the field and I'm unable to find it.

- therealjjj77 on January 17, 2014
Vote up!
0
Vote down!

@Ziobudda, Spam prevention isn't letting me to "Add New Comment" to your post without waiting for approval.

Thanks for your response.

Can you please specify if I should add it to the product display, product variation type or line item type: product. I've tried all three and can't seem to get the field to validate. Thanks!

Answer by: therealjjj77
Posted: Jan 18, 2014