Skip to content

Instantly share code, notes, and snippets.

@chrdesigner
Created May 23, 2015 15:36
Show Gist options
  • Select an option

  • Save chrdesigner/df1b11fab8b4c8d32a64 to your computer and use it in GitHub Desktop.

Select an option

Save chrdesigner/df1b11fab8b4c8d32a64 to your computer and use it in GitHub Desktop.
Adicionar Um Unico Item por Carrinho - WooCommerce
<?php
/*
* Função para adicionar um único item por carrinho
*/
function woo_unico_produto( $cart_item_data ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
return $cart_item_data;
}
add_filter( 'woocommerce_add_cart_item_data', 'woo_unico_produto' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment