woocommerce-subscriptions

WooCommerce Subscriptions - Get product of a specific subscription

ⅰ亾dé卋堺 提交于 2019-12-12 20:42:42
问题 Is there a way to get from $product from $subscription ? Thanks to this post, I know that from $subscription I can get $order : $order = $subscription->order; Is this also possible? $product = $subscription->product; Or: $product = $order->product; 回答1: It is possible to get the products from either the Subscription or the matching order, as a subscription object is an extension of the WC_Order class. $subscription_products = $subscription->get_items(); $order_products = $subscription->order-

Woocommerce checkout process creating new order at payment

允我心安 提交于 2019-12-12 02:45:13
问题 I'm having a problem with WordPress/Woocommerce creating a second order for customers. This is leading to a couple issues that I'll outline below. Here is the process I am following: Create and populate new Woocommerce Subscription object Create new renewal order (this will be ID 1033 below) and send invoice to customer Customer logs in and finds the pending order in My Account page Customer opens the pending order and it is populated with the correct products and price. Customer pays the

Add custom fee to woocommerce subscription recurring total fromcheckout

时光怂恿深爱的人放手 提交于 2019-12-11 10:26:15
问题 A custom checkout field which is a select field that is used to add a price to total price in checkout. When using WooCommerce Subscription plugin Recurring Total also appears. So is there any way, i can add custom checkout field price to recurring total too ? Please check this question too. A similar one Add custom fee to recurring total woocommerce subscription 回答1: Hey you may want to check out this doc from Woocommerce From the source: "by default, any cart fees added using the

Get all WooCommerce subscriptions

有些话、适合烂在心里 提交于 2019-12-11 04:35:37
问题 I a need to create a wordpress template to collect all Woocommerce subscriptions, but I'm having trouble with the documentation. I need to know which files to import and which function to call. Thank you in advice. 回答1: Update - You can use multiple ways: 1) The built in function wcs_get_subscriptions() which accepts specific arguments. In your case, to get all subscriptions, you will use: $subscriptions = wcs_get_subscriptions(['subscriptions_per_page' => -1]); You will get an array of

WooCommerce Subscriptions - Check if product already has an active subscriber

谁说胖子不能爱 提交于 2019-12-10 14:12:32
问题 I am using a plugin "WooCommerce Subscriptions" and I want to check if the product already has the active subscriber in the system I only want 1 subscriber per product. There is a filter available to check it but I don't know how to use it: https://docs.woocommerce.com/document/subscriptions/develop/filter-reference/ How can I use that functions or hooks, to achieve this? Thanks 回答1: This custom made conditional function will return true if a subscription product is already actively used by a

I want to configure the subscription endpoint located in my account page of woocommerce?

◇◆丶佛笑我妖孽 提交于 2019-12-08 06:46:10
问题 What i want is to edit a subscription in my account page of woocommerce. i have shared a picture below, of what exactly I want to edit. This is the link of picture, what i want to edit is highlighted with red pen: I want to edit the things which are highlighted with red pen. but i am unable to locate the exact page of this where i can edit things. actually i want to change the link of update button in subscription table. the URL of the page is like : https://www.example.com/my-account

Add custom fee to recurring total woocommerce subscription

落花浮王杯 提交于 2019-12-06 15:37:50
问题 function add_woocommerce_stripe_fee() { if ( ( is_admin() && ! defined( 'DOING_AJAX' ) ) || ! is_checkout() ) return; $chosen_gateway = WC()->session->chosen_payment_method; if ( 'stripe' == $chosen_gateway ) { $fee = (WC()->cart->cart_contents_total * .035) +0.35; WC()->cart->add_fee( 'Stripe Fee', $fee, false, '' ); } } add_action( 'woocommerce_cart_calculate_fees','add_woocommerce_stripe_fee' ); It is not adding for recurring cart total but works fine for normal product ( not working for

Add custom fee to recurring total woocommerce subscription

余生长醉 提交于 2019-12-04 21:31:54
function add_woocommerce_stripe_fee() { if ( ( is_admin() && ! defined( 'DOING_AJAX' ) ) || ! is_checkout() ) return; $chosen_gateway = WC()->session->chosen_payment_method; if ( 'stripe' == $chosen_gateway ) { $fee = (WC()->cart->cart_contents_total * .035) +0.35; WC()->cart->add_fee( 'Stripe Fee', $fee, false, '' ); } } add_action( 'woocommerce_cart_calculate_fees','add_woocommerce_stripe_fee' ); It is not adding for recurring cart total but works fine for normal product ( not working for Subscription products ). Any help would be greatly appreciated. Is this possible.? I provided a more in

Passing custom data from cart items to Order meta in Woocommerce 3

帅比萌擦擦* 提交于 2019-12-04 18:14:32
I have implemented a custom HTML Form and asking for some data which my customers will pass to place order successfully. Without these details my order has no importance. For HTML form, I am referencing some custom PHP script which is below and which processes POST data from the Form and creates Cart with these data programmatically. Thanks @LoicTheAztec to help me achieve this. The script.php file code: <?php require_once("../wp-load.php"); $customer_name = $_POST["customer_name"]; $customer_email = $_POST["customer_email"]; $customer_sex = $_POST["customer_sex"]; $customer_age = $_POST[

Detecting if the current user has an active subscription

依然范特西╮ 提交于 2019-12-04 11:41:20
问题 I'm developing a website in WordPress with WooCommerce. I'm using additionally WC Paid Listings and WooCommerce Subscriptions plugins to handle my work. The problem is when a user with "subscriber" role with an active subscription login and try to post a content every time he / she has to choose a package even he has an active subscription. Is there anyone with an idea of how to detect if user has an active subscription , if it returns true then the step choosing package skipped? Thanks. 回答1: