0

I am building an Aramex Shipping Plugin for WooCommerce Shopping Cart. I can set the calculated amount by using the add_rate method, but if there is any Error Response from the API, I am not able to show this message in the WooCommerce checkout.

Is there any way to show string messages in the WooCommerce checkout?

honk
  • 9,137
  • 11
  • 75
  • 83
  • Could you grab the error and then use the `woocommerce_before_checkout_form` filter to echo it? – Anthony Valera Jun 11 '14 at 21:26
  • Have you solved your issue ? If yes, could you please post how have you integrated the plugin or any link for reference ? – 5eeker May 10 '15 at 17:45

1 Answers1

0

You can use wc_add_wp_error_notices for set error message.

This Example

if ($response) {
$rate = array(
    'id' => $this->id,
    'label' => 'Label for Shipping Method',
    'cost' => 10
);
// Register the rate
$this->add_rate($rate);

} else {
wc_add_wp_error_notices(new WP_Error(1,'error in get response from webservice'));

}
Reza1607
  • 58
  • 1
  • 8