Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created June 17, 2020 08:27
Show Gist options
  • Select an option

  • Save hedqvist/b1417150bf467b6991a79ad233d5a7d8 to your computer and use it in GitHub Desktop.

Select an option

Save hedqvist/b1417150bf467b6991a79ad233d5a7d8 to your computer and use it in GitHub Desktop.
BankID - Age Limit on all Products
<?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