简体   繁体   中英

WooCommerce, manually add a product and price for purchase

I'm trying to figure out if there's a way to use the WooCommerce Cart and Checkout functionality if I need to purchase something that isn't technically a product

In other words, it's a completely independent "membership" that needs to be purchased, but isn't a product post.

I'd love to be able to add an item in the cart manually ... manual name, manual price, manual meta data and then purchase.

Does anyone have any idea how to do this?

here is example

global $woocommerce;
$woocommerce->cart->add_to_cart(16);

16 -> this is ID of existing product in store

documentation Link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM