Created
June 17, 2020 08:27
-
-
Save hedqvist/b1417150bf467b6991a79ad233d5a7d8 to your computer and use it in GitHub Desktop.
BankID - Age Limit on all Products
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @snippet WooCommerce - BankID plugin by Redlight Media - Add Age control on all products | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 4.2.0 | |
| */ | |
| add_action( 'woocommerce_add_cart_item_data', 'limit_all_products', 10, 3 ); | |
| function limit_all_products( $cart_item_data, $product_id, $variation_id ) { | |
| $cart_item_data['is_age_verification_required'] = 'yes'; | |
| return $cart_item_data; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment