Skip to content
Advertisement

How to get Shipping Methods custom additional data in Woocommerce?

From this comment I’ve created custom field “Shipping Method Description” inside shipping methods:

JavaScript

But I can’t understand how to get this data in front-end inside my custom shipping template(/cart/cart-shipping.php) like:

JavaScript

This comment isn’t clear for me how to get this instance settings.
Can anyone suggest a solution?

Advertisement

Answer

WooCommerce shipping method settings are stored in wp_options table on option_name column as follows (where $methods_id is name (slug) and $instance_id the numerical identifier):

JavaScript

To get that shipping method settings (array) you can use WordPress get_option() function like:

JavaScript

Tested and works.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement