That’s pretty much it. My php-fu is still quite weak, and I’m still pretty new to woocommerce as well.

I need to create a script that checks for one of two specific product ids in the cart on the checkout page, and if one is there, add a “paypal email address” text field and a “receive-newsletter?” checkbox, as well as swap out a div I created in the “form-shipping.php” template with another, hidden div.

Surprisingly, my research so far hasn’t turned up much in even just successfully confirming matching product_ids in the cart on the checkout page, which seems like it would be a reasonably common need. I’d consider that alone to be a huge victory at this point.

Any suggestions, guidance or clues on accomplishing this goal would be greatly appreciated.

Read more here: Woocommerce – if one of two product_ids is in cart at checkout, add form fields and show/hide divs


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: