Cart Contents - Filter Hook References

Modified on Mon, 19 Sep, 2022 at 8:43 AM

This is simply a list of cart contents-related filter hooks found within the WooCommerce Table Rate Shipping files. This list also includes the supported parameters and example codes.


wtars_shipped/get-cart-item

  • Parameters:
  • $cart_item array()
  • $item array()


Example Codes:

function custom_fee_title( $cart_item, $item ) {

    //add your custom code here
    return $cart_item;
}

add_filter( 'wtars_shipped/get-cart-item', 'custom_get_cart_item', 10, 2 );

wtars_shipped/get-cart-product-data

  • Parameters:
  • $product_data array()
  • $product array()
  • $item_key array()


Example Codes:

function custom_get_cart_product_data( $product_data, $product, $item_key ) {

    //add your custom code here
    return $product_data;
}

add_filter( 'wtars_shipped/get-cart-product-data', 'custom_get_cart_product_data', 10, 3 );

wtars_shipped/get-cart-totals

  • Parameters:
  • $totals array()
  • $cart array()


Example Codes:

function custom_get_cart_totals( $totals, $cart ) {

    //add your custom code here
    return $totals;
}

add_filter( 'wtars_shipped/get-cart-totals', 'custom_get_cart_totals', 10, 2 );

wtars_shipped/get-cart-applied-coupons

  • Parameters:
  • $applied_coupons array()
  • $cart array()


Example Codes:

function custom_get_cart_applied_coupons( $applied_coupons, $cart ) {

    //add your custom code here
    return $applied_coupons;
}

add_filter( 'wtars_shipped/get-cart-applied-coupons', 'custom_get_cart_applied_coupons', 10, 2 );

wtars_shipped/get-cart-shipping-rates

  • Parameters:
  • $shipping_rates array()
  • $cart array()


Example Codes:

function custom_get_cart_shipping_rates( $shipping_rates, $cart ) {

    //add your custom code here
    return $shipping_rates;
}

add_filter( 'wtars_shipped/get-cart-shipping-rates', 'custom_get_cart_shipping_rates', 10, 2 );

wtars_shipped/get-cart-method-id

  • Parameters:
  • $method_id array()
  • $cart array()


Example Codes:

function custom_get_cart_method_id( $method_id, $cart ) {

    //add your custom code here
    return $method_id;
}

add_filter( 'wtars_shipped/get-cart-method-id', 'custom_get_cart_method_id', 10, 2 );

wtars_shipped/get-cart-customer

  • Parameters:
  • $customer array()
  • $cart array()


Example Codes:

function custom_get_cart_customer( $customer, $cart ) {

    //add your custom code here
    return $customer;
}

add_filter( 'wtars_shipped/get-cart-customer', 'custom_get_cart_customer', 10, 2 );

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article