Skip to content

Commit

Permalink
Merge pull request #168 from TycheSoftwares/fix-167
Browse files Browse the repository at this point in the history
Fix #167
  • Loading branch information
mital-tyche authored Jul 4, 2023
2 parents 6862221 + 0b157c5 commit bf0f7da
Show file tree
Hide file tree
Showing 4 changed files with 267 additions and 271 deletions.
16 changes: 10 additions & 6 deletions includes/class-alg-wc-checkout-fees-args.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,17 @@ public function get_the_args_local( $current_gateway, $product_id, $variation_id
$do_add_product_name = ( 'yes' === get_option( 'alg_woocommerce_checkout_fees_per_product_add_product_name', 'no' ) );
if ( $do_add_product_name ) {
if ( isset( $variation_id ) && 0 != $variation_id ) {
$_product = wc_get_product( $variation_id );
$product_formatted_name = ' – ' . $_product->get_title() . ' – ' .
( version_compare( get_option( 'woocommerce_version', null ), '3.0.0', '<' ) ?
$_product->get_formatted_variation_attributes( true ) : wc_get_formatted_variation( $_product, true ) );
$_product = wc_get_product( $variation_id );
if ( $_product ) {
$product_formatted_name = ' &ndash; ' . $_product->get_title() . ' &ndash; ' .
( version_compare( get_option( 'woocommerce_version', null ), '3.0.0', '<' ) ?
$_product->get_formatted_variation_attributes( true ) : wc_get_formatted_variation( $_product, true ) );
}
} else {
$_product = wc_get_product( $product_id );
$product_formatted_name = ' &ndash; ' . $_product->get_title();
$_product = wc_get_product( $product_id );
if ( $_product ) {
$product_formatted_name = ' &ndash; ' . $_product->get_title();
}
}
}
$args = array();
Expand Down
Loading

0 comments on commit bf0f7da

Please sign in to comment.