Created
August 7, 2020 07:33
-
-
Save DxDiagDx/b0cd5f1621fba94b71c037b410aa40ad to your computer and use it in GitHub Desktop.
WOO: условие вывода, если в корзине есть товар с определённым ID
This file contains 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
function bbloomer_find_id_in_cart() { | |
foreach ( WC()->get_cart() as $cart_item_key => $values) { | |
$product = $values['data']; | |
if ( $product->get_id() == 123 ) { | |
// do something | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment