Answer the question
In order to leave comments, you need to log in
How to display delivery methods on the main page?
I was only able to get to the instance_id, but I can't find a query on the wp_options table that gets info about shipping methods.
$WC_Shipping_Zone_Data_Store = new WC_Shipping_Zone_Data_Store();
print_r($WC_Shipping_Zone_Data_Store->get_methods(1, true));
Answer the question
In order to leave comments, you need to log in
Found a solution to the issue.
foreach(WC_Shipping_Zones::get_zones()[1]['shipping_methods'] as $method) {
if($method->id === 'flat_rate') {
echo '<li>' . $method->instance_settings['title'] . ': ' . wc_price($method->instance_settings['cost']) . '</li>';
}
}
$WC_Shipping_Zone_Data_Store = new WC_Shipping_Zone_Data_Store();
foreach($WC_Shipping_Zone_Data_Store->get_methods(1, true) as $method) {
if($method->method_id === 'flat_rate') {
$m = WC_Shipping_Zones::get_shipping_method($method->instance_id);
echo '<li>' . $m->instance_settings['title'] . ': ' . wc_price($m->instance_settings['cost']) . '</li>';
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question