Skip to content

Instantly share code, notes, and snippets.

@webdados
Created December 2, 2022 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdados/1b14574564e9ef0d853a5c1d43a9ed3c to your computer and use it in GitHub Desktop.
Save webdados/1b14574564e9ef0d853a5c1d43a9ed3c to your computer and use it in GitHub Desktop.
Product Assembly / Gift Wrap / ... Cost for WooCommerce product_assembly_cart_data filter example
<?php
add_filter( 'product_assembly_cart_data', function( $data, $service_name, $cost_display, $cost_multiply, $item_data, $cart_item ) {
$data['name'] = $service_name.' and some more text';
$data['value'] = 'The cost'.( $cost_multiply ? ' per item ' : ' ' ).' is '.wc_price( $cost_display );
$data['display'] = $data['value']; // We just show the same as value
return $data;
}, 10, 6 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment