on the url checkout/OID
I have
Subtotal 6,189 €
50% Tax 3,095 €
Order total 9,284 €

but I want to change Subtotal label and order total label
how do I do that ?

I have tried stringoverrides module tried hook_commerce_order_update and hook_commerce_order_presave and hook_preprocess_field but either the changes but I don't have any luck with them

CommentFileSizeAuthor
#7 componet-title.patch345 bytesjmaties
#6 componet-title.patch345 bytesjmaties

Comments

giorgosk’s picture

Finally seems that stringoverrides changes Subtotal
but still it does not change Order Total

giorgosk’s picture

Ended up using an ugly str_replace

function THEMENAME_preprocess_views_view(&$vars) {
  if($vars["name"]=="commerce_cart_summary") {
    $vars["footer"] = str_replace("Order total","Order total (before taxes)",$vars["footer"]);
  }
}

is there a better way ?

rszrama’s picture

Status: Active » Fixed

You should be able to use hook_commerce_price_formatted_components_alter() to change the labels on these. See the documentation in commerce_price.api.php.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jawad.shah’s picture

Firstly, I try with stringoverrides module but it is not working.

Ref #2 works for me, Thanks to Giorgosk.

zeropoint.IT

jmaties’s picture

StatusFileSize
new345 bytes

You can use this patch

jmaties’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new345 bytes

Upps sorry change version :P

dsdeiz’s picture

Hm, that's kinda weird. Did a check on the commerce_price.module and it looks like this component title is coming from the instance label of the commerce_order_total field of that order entity. Shouldn't this be already translatable?

thirdender’s picture

Issue summary: View changes

You want to implement hook_commerce_price_component_type_info_alter(&$component_types):

function MY_MODULE_commerce_price_component_type_info_alter(&$component_types) {
  // Alters 'Discount' pricing item to display 'You save' instead
  $component_types['discount']['display_title'] = t('You save');
}
kenorb’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#1473312: How to change the order of commerce-price-formatted-components in checkout review
kenorb’s picture

Category: Support request » Bug report
Priority: Normal » Minor
bojanz’s picture

Category: Bug report » Support request
Status: Reviewed & tested by the community » Fixed

#9 is the way to go. Adding t() around a variable is never a committable patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.