Skip to content

Instantly share code, notes, and snippets.

@jmabbas
Last active March 5, 2026 10:55
Show Gist options
  • Select an option

  • Save jmabbas/645f5d9fc874852c1bab94ef970d012a to your computer and use it in GitHub Desktop.

Select an option

Save jmabbas/645f5d9fc874852c1bab94ef970d012a to your computer and use it in GitHub Desktop.
Electro - Cart page custom
add_action( 'init', 'ec_child_cart_shipping_calculator_link', 10 );
function ec_child_cart_shipping_calculator_link() {
add_action( 'woocommerce_before_cart', 'custom_shipping_calculator_link', 8 );
add_action( 'woocommerce_before_shipping_calculator', 'custom_shipping_calculator_link_redirect', 8 );
}
function custom_shipping_calculator_link() {
?>
<a href="#shipping-calculator-form-redirect" class="custom-shipping-calculator-link" style="display: none; color: #ce2020; text-decoration: underline;justify-content: center;" aria-expanded="false" aria-controls="shipping-calculator-form" role="button">Click here to calculate shipping fees</a>
<?php
}
function custom_shipping_calculator_link_redirect() {
?>
<div id="shipping-calculator-form-redirect"></div>
<?php
}
@media (max-width: 767px) {
table.shop_table.shop_table_responsive tr td.product-thumbnail {
display: block;
margin: 0 auto;
}
table.shop_table.shop_table_responsive tr td:before {
content: none;
}
tr.woocommerce-cart-form__cart-item.cart_item {
display: flex !important;
flex-wrap: wrap;
align-items: center;
}
table.shop_table td.product-remove {
width: 100%;
}
td.product-name {
width: 60%;
}
td.product-thumbnail,
td.product-price,td.product-quantity,td.product-subtotal {
width:30%;
}
.custom-shipping-calculator-link {
display: flex !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment