WP SITES

3082 Coded Tutorials & 285 Plugins

Add Custom HTML Before Shipping Address Block On Checkout Page

This code enables you to add the custom HTML before the shipping address block on the WooCommerce checkout page.

You can add any type of content or execute a function using this checkout page hook on your block checkout page.

The code enables you to hook your custom content or function below the contact information block and before the shipping address block.

Add the code to the end of your child themes functions file or custom functionality/code snippets plugin.

add_filter( 'render_block', 'wpsitesdotnet_shipping_method_block', 10, 2 );
function wpsitesdotnet_shipping_method_block( $block_content, $block ) {

        if ( isset( $block['blockName'] ) && $block['blockName'] === 'woocommerce/checkout-shipping-method-block' ) {
     
        $content = '<p>Custom HTML Before Shipping Address Block</p>';
        
        return $content;
        
        }
        
        return $block_content;
        
}

Related Solutions :

Leave a Reply

New Plugins