Answer the question
In order to leave comments, you need to log in
How to change cart appearance in storefront (wordpress) theme?
In general, there is a site on wordpress + woocommerce and the storefront theme, it is not possible to change the appearance of the basket that is in the header, swap elements, etc., there is such code in the storefront theme, you can help figure out what it is responsible for:
function storefront_cart_link_fragment( $fragments ) {
global $woocommerce;
ob_start();
storefront_cart_link();
$fragments['a.cart-contents'] = ob_get_clean();
ob_start();
storefront_handheld_footer_bar_cart_link();
$fragments['a.footer-cart-contents'] = ob_get_clean();
return $fragments;
}
function storefront_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'storefront' ); ?>">
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) );?></span>
</a>
<?php
}
Answer the question
In order to leave comments, you need to log in
storefront_cart_link()
sets the html code of the cart. We change it to the one we need.In general, the appearance is usually changed using CSS, your spans have classes, due to which the appearance is configured
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question