3,
'columns' => 3,
);
$args = wp_parse_args( $defaults, $args );
return $args;
}
add_filter( 'woocomerce_output_related_products_args', 'astromag_woocomerce_related_products_args' );
if ( ! function_exists( 'astromag_woocomerce_product_columns_wrapper' ) ) {
/**
* Product columns wrapper.
*
* @return void
*/
function astromag_woocomerce_product_columns_wrapper() {
$columns = astromag_woocomerce_loop_columns();
echo '
';
}
}
add_action( 'woocomerce_before_shop_loop', 'astromag_woocomerce_product_columns_wrapper', 40 );
if ( ! function_exists( 'astromag_woocomerce_product_columns_wrapper_close' ) ) {
/**
* Product columns wrapper close.
*
* @return void
*/
function astromag_woocomerce_product_columns_wrapper_close() {
echo '
';
}
}
add_action( 'woocomerce_after_shop_loop', 'astromag_woocomerce_product_columns_wrapper_close', 40 );
/**
* Remove default woocomerce wrapper.
*/
remove_action( 'woocomerce_before_main_content', 'woocomerce_output_content_wrapper', 10 );
remove_action( 'woocomerce_after_main_content', 'woocomerce_output_content_wrapper_end', 10 );
if ( ! function_exists( 'astromag_woocomerce_wrapper_before' ) ) {
/**
* Before Content.
*
* Wraps all woocomerce content in wrappers which match the theme markup.
*
* @return void
*/
function astromag_woocomerce_wrapper_before() {
?>
*/
if ( ! function_exists( 'astromag_woocomerce_cart_link_fragment' ) ) {
/**
* Cart Fragments.
*
* Ensure cart contents update when products are added to the cart via AJAX.
*
* @param array $fragments Fragments to refresh via AJAX.
* @return array Fragments to refresh via AJAX.
*/
function astromag_woocomerce_cart_link_fragment( $fragments ) {
ob_start();
astromag_woocomerce_cart_link();
$fragments['a.cart-contents'] = ob_get_clean();
return $fragments;
}
}
add_filter( 'woocomerce_add_to_cart_fragments', 'astromag_woocomerce_cart_link_fragment' );
if ( ! function_exists( 'astromag_woocomerce_cart_link' ) ) {
/**
* Cart Link.
*
* Displayed a link to the cart including the number of items present and the cart total.
*
* @return void
*/
function astromag_woocomerce_cart_link() {
?>
cart->get_cart_contents_count(), 'astromag' ),
WC()->cart->get_cart_contents_count()
);
?>
cart->get_cart_subtotal() ); ?>