Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save senadir/895e901e7189d9546d8200eac2fbbd90 to your computer and use it in GitHub Desktop.
Save senadir/895e901e7189d9546d8200eac2fbbd90 to your computer and use it in GitHub Desktop.
Testing instructions for WC Subscriptions Checkout/Cart Block

WC Subscriptions Checkout/Cart Block Testing

Prerequisites

  • The provided version of WC Subscriptions and WC blocks, WC Subscriptions importer, and WC 5.1 are required.
  • Multiple subscription products imported via a csv (provided).
  • Multiple subscriptions imported via a csv (provided).
  • At first, shipping and taxes disabled.

Setup

  • Edit "Cart" page and insert Cart block instead of Shortcode, save.
  • Edit "Checkout" page and insert Checkout block instead of Shortcode, save.
  • Go to WooCommerce -> Settings -> Subscriptions. Enable:
    • Manual Renewal Payments: Accept Manual Renewals.
    • Allow Switching: Between Subscription Variations.
    • Prorate Recurring Payment: For Upgrades & Downgrades of All Subscription Products
    • Synchronise renewals: Align Subscription Renewal Day.
  • Go to Tools -> Import -> WooCommerce products (CSV) and click run importer.
    • Import file "products.csv".
  • In Products, go to edit "Switch Product" and Attributes, enable "used for variations" image
    • In the same product, go to "Variations" and add variant twice image
    • Set the first to A and the second to B image
    • Set the first one subscription price to 10 and the second to 50 image
    • Save the product.
  • Go to WooCommerce -> Subscription Importer and import "subscriptions.csv" file.
  • Go to Marketing -> Coupons and create: a sign-up fee, sign-up fee %, fixed cart, recurring cart, and recurring cart % coupon created.

Cart

Single subscription product

These tests should be ran for each product billing period type. There's a product for each billing term named "Daily", "Weekly", "Monthly", and "Yearly"

  • Verify that the product can be added to the cart.
  • On the cart block page confirm:
    • the "Total due today" and the "{Period} recurring total" match the product total.
    • the "Starting:" date is 1 billing period (day, week, month, or year) from today's date depending on the product's recurring period.
  • Increase the product's quantity and confirm the "Total due today" and the "{Period} recurring total" increase and decrease accordingly.

Screen Shot 2021-03-19 at 12 53 26 pm

Two subscription period products

  • Add a "Weekly" and "Yearly" product to the cart.
  • On the cart block page confirm:
    • the "Total due today" match the two product's total.
    • there are 2 recurring total sections displayed.
    • the "Starting:" date is 1 billing period (week and year) from today's date depending on the recurring term.

Screen Shot 2021-03-19 at 1 01 11 pm

Two subscription products with the same billing terms

  • Add "Weekly" and "Weely 2" products to the cart.
  • On the cart block page confirm:
    • the "Total due today" and "Weekly recurring total" match the two product's total.
    • the "Starting:" date is 1 week from today's date.
    • Increase the product's quantity and confirm the "Total due today" and the "Weekly recurring total" increase and decrease accordingly.

Screen Shot 2021-03-19 at 1 15 44 pm

Subscription with length

  • Add the "Monthly – length 5" product to the cart.
  • On the cart block page confirm:
    • the "Total due today" matches the product's total.
    • the "Starting:" date is 1 month from today's date.
    • the number of payments is displayed in the recurring totals section - "For 5 months"

Screen Shot 2021-03-19 at 1 22 39 pm

Subscription with trial

  • Add the "Yearly - free trial" product to the cart.
  • On the cart block page confirm:
    • the "Total due today" is $0.
    • the free trial period is listed as a feature of the product.
    • the "Yearly recurring total" matches the product's recurring price.
    • the "Starting:" date is 2 months from today's date - free trial end date.
  • Increase/decrease the product quantity and confirm the Due today amount remains $0 but the recurring total increases.

Screen Shot 2021-03-19 at 1 38 47 pm

Subscription with sign-up fee

  • Add the "Daily - sign-up fee" product to the cart.
  • On the cart block page confirm:
    • the "Total due today" is $41 (sign-up fee + recurring amount).
    • the sign up fee is listed as a feature of the product.
    • the "daily recurring total" matches the product's recurring price ($1).
    • the "Starting:" date is tomorrows date.
  • Increase/decrease the product quantity and confirm the "Due today" amount increases/decreases in intervals of $41 but the recurring total increases/decreases by $1.

Renewal synchronised subscription

  • Add the "Synced – Monday" product to the cart. If today happens to be Monday, use the "Synced - Friday" product instead.
  • On the cart block page confirm:
    • the "Total due today" is $0.
    • the synchronised payment day is listed as a feature of the product. ("Renews: every Monday")
    • the "Weekly recurring total" should be $7.
    • the "Starting:" date should be the coming Monday's (or Friday's) date.
  • In WooCommerce > Settings > Subscriptions under Synchronisation change the "Prorate First Renewal" setting to be "For All Subscription Products". (https://d.pr/i/lIChNv)
  • Refresh the cart blocks page and confirm the following:
    • the "Total due today" should now be $0-$7 depending on what day of the week you test (it should be equal to the number of days until the payment day (eg Friday => Monday = 3 days -> $3).
    • everything else including the recurring amount and payment date should remain the same. $7 and the next occuring Monday's date

Screen Shot 2021-03-19 at 2 48 13 pm

Complex subscription

  • Add the "Complex Subscription" product to the cart.
  • On the cart block page confirm:
    • the "Total due today" is $70. (sign-up fee).
    • the free trial period is listed as feature (10 days)
    • the sign-up fee is listed as a feature of the product. ("$70")
    • the synchronised payment day is listed as a feature of the product. ("on May 14th each year")
    • the "Yearly recurring total" should be $8.
    • the "Starting:" date should be May 14 2021.
    • the total length of the subscription should appear in the recurring totals section ("For 5 years")

Screen Shot 2021-03-19 at 3 10 59 pm

Switching

  • From the front end of the site go to My Account > My Subscription
  • Under the Subscription totals section click Upgrade or Downgrade.
  • On the product page select the variation B and click "sign up now".
  • On the cart block page confirm:
    • the "Total due today" is $40 ($50 - $10 paid).
    • the "Monthly recurring total" is $50.
    • the switching Sign up fee is listed as $40.
    • the variation attribute is listed ('B').
  • In WooCommerce > Settings > Subscriptions under Switching change the "Prorate Recurring Payment" setting to be "Never". (https://d.pr/i/ktc2MX)
  • Refresh the cart blocks page and confirm the following:
    • the "Total due today" should now be $0.

Subscription coupons

  • Add the "Weekly" product to the cart.
  • On the cart block page add the 'signupfee' coupon to the cart.
  • You should get a "Sorry, this coupon is not applicable to selected products"
  • Add the 'signupfee%' coupon to the cart.
  • You should get a "Sorry, this coupon is not applicable to selected products"
  • Add the 'recurring%coupon' coupon to the cart.
  • The coupon should apply a discount of $1.
  • Extend the recurring details section and you will see the $1 discount applied to the recurring total too.

Screen Shot 2021-03-19 at 4 06 13 pm

  • Add the "Yearly – free trial" product to the cart.
  • On the cart block page add the 'fixedcart' coupon to the cart.
  • You should get a "Sorry, this coupon is only valid for an initial payment and the cart does not require an initial payment." error message. (https://d.pr/i/rAV4tQ)
  • Empty the cart.
  • Add the "Weekly" product to the cart.
  • On the cart block page add the 'fixedcart' coupon to the cart.
  • The coupon should successfully apply and reduce the initial payment (due today) figure only. The recurring total should remain at $5.

Screen Shot 2021-03-19 at 4 34 45 pm

Limited coupons

  • Create 2 recurring limited payment coupons:
  • Add a standard subscription product to the cart. (eg weekly).
  • Apply the 'recurringlimit2' coupon.
  • The discount will apply to both the initial payment and recurring amount.

Screen Shot 2021-03-22 at 3 58 53 pm

  • Remove the 'recurringlimit2' coupon.
  • Apply the 'recurringlimit1' coupon
  • The discount should apply to the initial payment only.

Screen Shot 2021-03-22 at 4 02 33 pm

  • Add a free trial product to the cart.
  • Remove the standard subscription product.
  • Because of the free trial, the 1 payment coupon will move to the recurring total.

Screen Shot 2021-03-22 at 4 06 11 pm

Shipping

  • Create 2 shipping methods for your shipping zone (geographic location).
  • Create 2 free shipping coupons - 1 fixed cart coupon (https://d.pr/i/kenSuE) - 1 recurring % coupon (https://d.pr/i/o10sOl)
  • Add a "Yearly", "Monthly", and "Weekly" product to the cart.
  • Free shipping should be available to the initial order total, and for the yearly subscription, but not available for the others.

screencapture-wcsblocks-local-cart-2-2021-03-22-13_56_04

  • Add the "freeshippingrecurring%" coupon to the cart.
  • Free shipping should now be available to all subscriptions. (https://d.pr/i/CAFHnG)
  • Remove the "yearly" product.
  • Remove the "freeshippingrecurring%" coupon.
  • Free shipping won't be available at all (https://d.pr/i/sCKy5I).
  • Apply the "freeshippingfixedcart" coupon.
  • Free shipping will be available to the initial purchase, but not the recurring totals (https://d.pr/i/I7Ku6V)
  • Remove all items from the cart.
  • Add the "Daily – sign-up fee" product to the cart.
  • Free shipping will be available to the initial payment, but not the recurring payment.

Screen Shot 2021-03-22 at 2 16 35 pm

  • Empty the cart.
  • Add the "Yearly – free trial" and "Weekly" products to the cart.
  • Free shipping will only be available to the yearly recurring total since it's the only order or subscription greater than $40.

Checkout

  • Add a "Yearly", "Weekly", "Weekly 2" and "Monthly" product to the cart.
  • On the Checkout blocks page verify that there are 3 recurring total sections that correctly reflect the grouping of like-subscriptions. (https://d.pr/i/WrvIY9)
  • Change the chosen shipping method for the yearly recurring total, confirm the yearly recurring total changes accordingly. (https://d.pr/v/9q2FU3).
  • Place the order.
  • Confirm on the order received page that there are 3 subscriptions (https://d.pr/i/3EQD1y).
  • Confirm each subscription has the correct items, shipping, addresses and total.
  • From the admin dashboard, go to WooCommerce > Subscriptions and edit one of the subscriptions you just purchased.
  • Edit the billing details and confirm that the payment gateway tokens are set.

Screen Shot 2021-03-24 at 3 29 57 pm

Manually renewing a subscription

  • From the admin dashboard, go to WooCommerce > Subscriptions and edit one of the subscriptions.
  • Edit the line items (https://d.pr/i/RmdUUS)
  • Manually reduce the item amount. (https://d.pr/i/aAmY5l)
  • Save and Recalculate
  • From the actions drop-down in the top right-hand corner, select "Create pending renewal order" (https://d.pr/i/lQGwnL) and click "Update".
  • Go to WooCommerce > Orders and edit the top most order.
  • Click the Customer payment page → link. (https://d.pr/i/8fTE9E)
  • The cart and checkout will be populated with the renewal order.
  • Confirm:
    • That there's no recurring total section displayed.
    • That the product totals are listed as due today.
    • That the product totals are correct.
    • That the manual discount you applied to the subscription is reflected on the checkout via a coupon.
  • Place the order and confirm the renewal order is linked to the correct subscription.

Screen Shot 2021-03-24 at 4 12 39 pm

Early renewal

  • View one of the subscriptions you purchased from the customer's My account > Subscriptions screen.
  • Click the "Renew now" button.
  • Once you land on the checkout page, confirm that all line items are added to the cart, the total is correct and that no recurring totals are shown.
  • Place the order and confirm the renewal order is linked to the correct subscription.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment