Skip to content

Instantly share code, notes, and snippets.

@raselahmed7
Created August 1, 2017 06:53
Show Gist options
  • Save raselahmed7/beaf8a106e76f4bb82a85ca3a7707a78 to your computer and use it in GitHub Desktop.
Save raselahmed7/beaf8a106e76f4bb82a85ca3a7707a78 to your computer and use it in GitHub Desktop.
function header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
woocommerce_cart_link();
$fragments['a.cart-button'] = ob_get_clean();
return $fragments;
}
add_filter('add_to_cart_fragments', 'header_add_to_cart_fragment');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment