-1

I am working on a Drupal commerce site. Everything is working fine as per my requirement. But I have to modify some setting for checkout preview page (price detail table).

Currently into the product detail price table, there are shipping price and VAT price are there and the VAT price is depends on Subtotal price. I mean the VAT price ($75) is 25% of Subtotal price ($300).

Now I want to change VAT price functionality, means the VAT price will be 25% of sum of 'Subtotal price and shipping price' (i.e. $300 + $78 = $378). So now the VAT price will be $94.5.

and the sequence of the price type will be

1. Subtotal
2. Shipping
3. VAT
4. Order total

So how can I set VAT price 25% of 'Subtotal price and Shipping price'? And How can I manage their sequence?

Recently the table is showing look like the attached screenshot:

enter image description here

1 Answer 1

1

Aah!, finally I got the answer of my question and now everything is working absolutely fine as per my requirement.

For this we just create a new Rule for this. Here is the exported code of my created Rule.

{ "rules_taxes_shipping" : {
"LABEL" : "Taxes Shipping",
"PLUGIN" : "reaction rule",
"WEIGHT" : "9",
"OWNER" : "rules",
"TAGS" : [ "Shipping", "taxes" ],
"REQUIRES" : [ "commerce_tax", "commerce_shipping" ],
"ON" : { "commerce_shipping_calculate_rate" : [] },
"DO" : [
  { "commerce_tax_calculate_by_type" : {
      "commerce_line_item" : [ "commerce-line-item" ],
      "tax_type_name" : "vat"
    }
  }
]
}
}

And to rearrange the sequence of the price item just set weight for that particular item using alter, look like the below code.

function hook_commerce_price_formatted_components_alter(&$components, $price, $entity) {
  $components['flat_rate_shipping']['weight'] = 0;
  $components['tax|vat']['weight'] = 1;
}

This will set the sequence of this item.

1. Subtotal
2. Shipping
3. VAT
4. Order total
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.