Created
February 20, 2026 11:05
-
-
Save xlplugins/4f20ee321dae74424247588bc2a643be to your computer and use it in GitHub Desktop.
shipping layout one by one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Plugin Name: WFACP Shipping Layout - One by One | |
| * Description: Snippet-only. Block-style shipping (name, est, price on separate lines). No core edits. | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| add_filter( 'woocommerce_cart_shipping_method_full_label', 'wfacp_shipping_label_split', 10, 2 ); | |
| add_action( 'wp_footer', 'wfacp_shipping_layout_styles', 999 ); | |
| function wfacp_shipping_label_split( $label, $method ) { | |
| if ( ! function_exists( 'wfacp_template' ) || ! wfacp_template() ) { | |
| return $label; | |
| } | |
| $i = strpos( $label, '|' ); | |
| if ( false === $i ) { | |
| return $label; | |
| } | |
| $name = trim( substr( $label, 0, $i ) ); | |
| $est = trim( substr( $label, $i + 1 ) ); | |
| $est = preg_replace( '/\s*:.*$/', '', $est ); | |
| $est = strtoupper( $est ); | |
| return '<span class="wfacp_shipping_name">' . esc_html( $name ) . '</span><span class="wfacp_shipping_est">' . esc_html( $est ) . '</span>'; | |
| } | |
| function wfacp_shipping_layout_styles() { | |
| if ( ! function_exists( 'is_checkout' ) || ! is_checkout() || ! function_exists( 'wfacp_template' ) || ! wfacp_template() ) { | |
| return; | |
| } | |
| ?> | |
| <style id="wfacp-shipping-one-by-one"> | |
| .wfacp_main_form .wfacp_shipping_table .wfacp_single_shipping { display: flex; flex-direction: column; } | |
| .wfacp_main_form .wfacp_shipping_table .wfacp_shipping_name { display: block; font-weight: 600; } | |
| .wfacp_main_form .wfacp_shipping_table .wfacp_shipping_est { display: block; margin-top: 4px; font-size: .85em; color: #777; text-transform: uppercase; } | |
| .wfacp_main_form .wfacp_shipping_table .wfacp_single_shipping .wfacp_shipping_price, | |
| .wfacp_main_form .wfacp_shipping_table .wfacp_shipping_cost_no_field_used { display: block !important; padding-left: 22px !important; margin-top: 8px; clear: both; font-weight: 600; font-size: 1.1em; text-align: left !important; } | |
| </style> | |
| <?php | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment