Forums › URL Coupons for WooCommerce › Question
- Support forum for the WooCommerce Coupons & Add to Cart by URL Links.
- This topic has 1 reply, 2 voices, and was last updated 4 years, 11 months ago by Tom Anbinder.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
February 3, 2020 at 1:42 pm #92536Ishan MakkarParticipant
Hi All,
With the help of your plugin. I am not able to get the “excluded_product_categories” and “excluded_product_ids” parameter. Please check the below-returned object. Please let me know how can I get these variables. “coupon20” is my coupon code.
ThanksShow more…
Array ( [coupon20] => WC_Coupon Object ( [data:protected] => Array ( [code] => coupon20 [amount] => 50 [date_created] => WC_DateTime Object ( [utc_offset:protected] => 0 [date] => 2019-10-09 13:17:10.000000 [timezone_type] => 1 [timezone] => +00:00 ) [date_modified] => WC_DateTime Object ( [utc_offset:protected] => 0 [date] => 2020-02-03 12:21:17.000000 [timezone_type] => 1 [timezone] => +00:00 ) [date_expires] => WC_DateTime Object ( [utc_offset:protected] => 0 [date] => 2020-05-30 00:00:00.000000 [timezone_type] => 1 [timezone] => +00:00 ) [discount_type] => percent [description] => [usage_count] => 0 [individual_use] => 1 [product_ids] => Array ( [0] => 21769 ) [excluded_product_ids] => Array ( ) [usage_limit] => 100000 [usage_limit_per_user] => 100000 [limit_usage_to_x_items] => 100000 [free_shipping] => [product_categories] => Array ( [0] => 3938 [1] => 4524 [2] => 4327 ) [excluded_product_categories] => Array ( [0] => 3935 [1] => 4299 ) [exclude_sale_items] => [minimum_amount] => [maximum_amount] => [email_restrictions] => Array ( ) [used_by] => Array ( ) [virtual] => ) [cache_group:protected] => coupons [id:protected] => 3604 [changes:protected] => Array ( ) [object_read:protected] => 1 [object_type:protected] => data [extra_data:protected] => Array ( ) [default_data:protected] => Array ( [code] => [amount] => 0 [date_created] => [date_modified] => [date_expires] => [discount_type] => fixed_cart [description] => [usage_count] => 0 [individual_use] => [product_ids] => Array ( ) [excluded_product_ids] => Array ( ) [usage_limit] => 0 [usage_limit_per_user] => 0 [limit_usage_to_x_items] => [free_shipping] => [product_categories] => Array ( ) [excluded_product_categories] => Array ( ) [exclude_sale_items] => [minimum_amount] => [maximum_amount] => [email_restrictions] => Array ( ) [used_by] => Array ( ) [virtual] => ) [data_store:protected] => WC_Data_Store Object ( [instance:WC_Data_Store:private] => WC_Coupon_Data_Store_CPT Object ( [meta_type:protected] => post [internal_meta_keys:protected] => Array ( [0] => _code [1] => _amount [2] => _date_created [3] => _date_modified [4] => _date_expires [5] => _discount_type [6] => _description [7] => _usage_count [8] => _individual_use [9] => _product_ids [10] => _excluded_product_ids [11] => _usage_limit [12] => _usage_limit_per_user [13] => _limit_usage_to_x_items [14] => _free_shipping [15] => _product_categories [16] => _excluded_product_categories [17] => _exclude_sale_items [18] => _minimum_amount [19] => _maximum_amount [20] => _email_restrictions [21] => _used_by [22] => _virtual [23] => discount_type [24] => coupon_amount [25] => expiry_date [26] => date_expires [27] => usage_count [28] => individual_use [29] => product_ids [30] => exclude_product_ids [31] => usage_limit [32] => usage_limit_per_user [33] => limit_usage_to_x_items [34] => free_shipping [35] => product_categories [36] => exclude_product_categories [37] => exclude_sale_items [38] => minimum_amount [39] => maximum_amount [40] => customer_email [41] => _used_by [42] => _edit_lock [43] => _edit_last ) [object_id_field_for_meta:protected] => [must_exist_meta_keys:protected] => Array ( ) ) [stores:WC_Data_Store:private] => Array ( [coupon] => WC_Coupon_Data_Store_CPT [customer] => WC_Customer_Data_Store [customer-download] => WC_Customer_Download_Data_Store [customer-download-log] => WC_Customer_Download_Log_Data_Store [customer-session] => WC_Customer_Data_Store_Session [order] => WC_Order_Data_Store_CPT [order-refund] => WC_Order_Refund_Data_Store_CPT [order-item] => WC_Order_Item_Data_Store [order-item-coupon] => WC_Order_Item_Coupon_Data_Store [order-item-fee] => WC_Order_Item_Fee_Data_Store [order-item-product] => WC_Order_Item_Product_Data_Store [order-item-shipping] => WC_Order_Item_Shipping_Data_Store [order-item-tax] => WC_Order_Item_Tax_Data_Store [payment-token] => WC_Payment_Token_Data_Store [product] => WC_Product_Data_Store_CPT [product-grouped] => WC_Product_Grouped_Data_Store_CPT [product-variable] => WC_Product_Variable_Data_Store_CPT [product-variation] => WC_Product_Variation_Data_Store_CPT [shipping-zone] => WC_Shipping_Zone_Data_Store [webhook] => WC_Webhook_Data_Store ) [current_class_name:WC_Data_Store:private] => WC_Coupon_Data_Store_CPT [object_type:WC_Data_Store:private] => coupon ) [meta_data:protected] => Array ( [0] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 14667 [key] => _wc_url_coupons_redirect_page [value] => 0 ) [data:protected] => Array ( [id] => 14667 [key] => _wc_url_coupons_redirect_page [value] => 0 ) ) [1] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 14681 [key] => _wc_url_coupons_unique_url [value] => coupon20 ) [data:protected] => Array ( [id] => 14681 [key] => _wc_url_coupons_unique_url [value] => coupon20 ) ) ) ) )
February 3, 2020 at 4:31 pm #92537Hi,
I’m not sure if I understood your question correctly, but if you need to get excluded product IDs from
WC_Coupon
object, you need to call:$coupon->get_excluded_product_ids();
and for the excluded category IDs:
$coupon->get_excluded_product_categories();
P.S. I’m not sure how you’ve formed the array in your example, but you should be able to get the object itself with:
$coupon = $your_array['coupon20'];
Hope that helps.
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.