简体   繁体   English

WooCommerce,手动添加产品和价格进行购买

[英]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 我想弄清楚是否有办法使用WooCommerce购物车和Checkout功能,如果我需要购买一些技术上不是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 16 - >这是商店现有产品的ID

documentation Link 文档链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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