Hello Thanks for the great support of the plugin.
I have encountered a small problem. I can add custom text and images to the standard shipping methods from WooCommerce. But unfortunately, if the shipping method is “Vendor Shipping” and the shipping method is, for example, “Free Shipping” – this no longer works.
Could you please tell me how exactly the code should look so that this works for “Vendor Shipping”.
add_filter( 'woocommerce_cart_shipping_method_full_label', 'filter_woocommerce_cart_shipping_method_full_label', 10, 2 );
function filter_woocommerce_cart_shipping_method_full_label( $label, $method ) {
$shipping_method_settings = array(
"flat_rate" => array(
"image_url" => site_url( '/wp-content/uploads/party-popper-2.webp' ),
"additional_text" => " (1)"
),
"local_pickup" => array(
"image_url" => site_url( '/wp-content/uploads/lock-1.webp' ),
"additional_text" => " (2)"
),
"free_shipping" => array(
"image_url" => site_url( '/wp-content/uploads/blue-diamond.webp' ),
"additional_text" => " (3)"
),
);
if ( isset( $shipping_method_settings[ $method->method_id ] ) ) {
$settings = $shipping_method_settings[ $method->method_id ];
$image_html = '<img src="' . esc_url( $settings['image_url'] ) . '" alt="' . esc_attr( $label ) . '" style="vertical-align: middle; margin-left: 5px;" />';
$label = $label . $settings['additional_text'] . $image_html;
}
return $label;
}