WooCommerce - 为购买的每件商品添加新商品到购物车

Current scenario : A new law in my country obligates me to add a 'Green Stamp' for almost all electrical products that a customer wants to purchase .

At the moment I only got working a percentage, like below .

add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
  //global $woocommerce;

    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
    return;

    $percentage = 0.0001;
    $surcharge = ( WC()->cart->cart_contents_total + WC()->cart->shipping_total ) * $percentage;    
    WC()->cart->add_fee( 'Green Stamp', $surcharge, true, 'standard' );

}

how can I add that custom Green Stamp product with a standard price for all products that a customer adds to cart, MINUS the products in some categs ?!

edited : $woocommerce deprecated

你好,大神,我想请教怎么恢复添加购物车按钮,之前建立了popup 弹窗改成了enqiury ,现在想恢复添加购物车,却显示灰色,怎么也该不了,请大神帮忙指点,谢谢!