Forum

Thread tagged as: Question, Shop

Reserving product while checking out. Avoiding parallel buying and negative inve...

As far as I can tell from my testing cases, it is possible to have 1 item (last in stock) and for two people to buy it at the same time.

This ends up with the scenario that you have two successfully paid orders of an item you only had 1 in stock of.

Is there a way to avoid this problem inbuilt in the shop, or a possible way to work around it by manually marking the item as sold while someone has it in their cart etc.? Or another option; on the last step of making the payment; making sure the product hasn't been sold while you were checking out yourself? Not the greatest user experience of course, to go through the whole checkout, only to – after paying – get feedback that "Sorry, the item is sold out".

Any feedback would be greatly appreciated.

Eddie

Eddie Dale

Eddie Dale 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

We check stock levels when reconfirming the cart before checkout, but yes, you can have multiple customers at that stage before payment is processed.

The only way to deal with that is to put a timed lock on products like a ticket selling website would. That's not something that Shop does currently. If it's a feature you need then Shop might not be the right solution.

Fair enough. Thanks for the answer.

It is any way to reconfirm the stock level before the payment goes through?

if (perch_member_logged_in() &&  perch_post('stripeToken')) {

  // your 'success' and 'failure' URLs
  $return_url = 'xxx';
  $cancel_url = 'xxx';

  perch_shop_checkout('stripe', [
    'return_url' => $return_url,
    'cancel_url' => $cancel_url,
    'token'      => perch_post('stripeToken')
  ]);
}

Say to add some function to check the inventory one last time before charging.

if (perch_member_logged_in() &&  perch_post('stripeToken') && $inventory-not-empty) {
...
}

Maybe by saving all the products in the order in an array and hitting the perch_shop_product() with each of the products – returning and saving the stock count of each in variables.

Will try that, but if there is any better way of checking the stock level of the items in the cart before proceeding with payment, advice is more than welcome.

I really want to be able to use Perch shop on this, but its very important to be certain that limited edition products don't risk getting sold more of than available.

Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_shop_cart() will essentially do this, so you could always call that and null the output.

perch_shop_cart([], true);

That definitely returns the information I need, but it doesnt seem to update live.

If I add to cart, and go to the last step (with order-overview and payment options), and var_dump the perch_shop_cart, the returned stock_level is stuck at the value it was when it was initially added to the cart – even though I change the stock count in perch admin. It doesn't matter how many times I refresh, the stock_level is stuck.

The same applies to going to the cart.php page. It still shows the item in the cart, even though its actually out of stock. Only if I go back to the product and try to add it to the cart again it clears the cart.

Any idea on why the stock_level doesn't update when refreshing?

Returned array for info (long after i've changed the values of stock level to 0 in admin):

array(52) {
  ["discount_code"]=>
  NULL
  ["promotions"]=>
  array(0) {
  }
  ["product_count"]=>
  string(1) "1"
  ["item_count"]=>
  string(1) "1"
  ["items"]=>
  array(1) {
    [0]=>
    array(22) {
      ["discount"]=>
      int(0)
      ["price_with_tax"]=>
      string(5) "50.00"
      ["price_with_tax_formatted"]=>
      string(8) "€50.00"
      ["price_without_tax"]=>
      string(5) "40.00"
      ["price_without_tax_formatted"]=>
      string(8) "€40.00"
      ["tax"]=>
      string(5) "10.00"
      ["tax_discount"]=>
      int(0)
      ["tax_formatted"]=>
      string(8) "€10.00"
      ["tax_rate"]=>
      string(5) "25.00"
      ["total_tax"]=>
      string(5) "10.00"
      ["total_tax_formatted"]=>
      string(8) "€10.00"
      ["total_with_tax"]=>
      string(5) "50.00"
      ["total_with_tax_formatted"]=>
      string(8) "€50.00"
      ["total_without_tax"]=>
      string(5) "40.00"
      ["total_without_tax_formatted"]=>
      string(8) "€40.00"
      ["ref_sale_prices"]=>
      array(15) {
        ["discount"]=>
        int(0)
        ["price_with_tax"]=>
        string(5) "50.00"
        ["price_with_tax_formatted"]=>
        string(8) "€50.00"
        ["price_without_tax"]=>
        string(5) "40.00"
        ["price_without_tax_formatted"]=>
        string(8) "€40.00"
        ["tax"]=>
        string(5) "10.00"
        ["tax_discount"]=>
        int(0)
        ["tax_formatted"]=>
        string(8) "€10.00"
        ["tax_rate"]=>
        string(5) "25.00"
        ["total_tax"]=>
        string(5) "10.00"
        ["total_tax_formatted"]=>
        string(8) "€10.00"
        ["total_with_tax"]=>
        string(5) "50.00"
        ["total_with_tax_formatted"]=>
        string(8) "€50.00"
        ["total_without_tax"]=>
        string(5) "40.00"
        ["total_without_tax_formatted"]=>
        string(8) "€40.00"
      }
      ["weight"]=>
      string(3) "500"
      ["sku"]=>
      string(8) "01asd-PP"
      ["title"]=>
      string(12) "Alaska bilde"
      ["Product"]=>
      object(PerchShop_Product)#27 (18) {
        ["factory_classname":protected]=>
        string(18) "PerchShop_Products"
        ["table":protected]=>
        string(20) "perch2_shop_products"
        ["pk":protected]=>
        string(9) "productID"
        ["index_table":protected]=>
        string(10) "shop_index"
        ["modified_date_column":protected]=>
        string(14) "productUpdated"
        ["deleted_date_column"]=>
        string(14) "productDeleted"
        ["duplicate_fields":protected]=>
        array(3) {
          ["productStockOnParent"]=>
          string(14) "stock_location"
          ["productSlug"]=>
          string(4) "slug"
          ["productStatus"]=>
          string(6) "status"
        }
        ["exclude_from_api":protected]=>
        array(12) {
          [0]=>
          string(15) "regular_pricing"
          [1]=>
          string(13) "current_price"
          [2]=>
          string(13) "productStatus"
          [3]=>
          string(14) "productCreated"
          [4]=>
          string(14) "productUpdated"
          [5]=>
          string(14) "productDeleted"
          [6]=>
          string(15) "productTemplate"
          [7]=>
          string(12) "productOrder"
          [8]=>
          string(14) "stock_location"
          [9]=>
          string(18) "productHasVariants"
          [10]=>
          string(20) "productStockOnParent"
          [11]=>
          string(12) "catalog_only"
        }
        ["event_prefix":protected]=>
        string(12) "shop.product"
        ["pk_is_int":protected]=>
        bool(true)
        ["date_fields":protected]=>
        array(0) {
        }
        ["suppress_events"]=>
        bool(false)
        ["api":protected]=>
        object(PerchAPI)#26 (4) {
          ["app_id"]=>
          string(10) "perch_shop"
          ["nav_app_id"]=>
          string(10) "perch_shop"
          ["version"]=>
          float(1)
          ["Lang":"PerchAPI":private]=>
          object(PerchAPI_Lang)#20 (5) {
            ["lang_dir"]=>
            string(101) "/apps/perch_shop/lang"
            ["lang_file"]=>
            string(111) "/apps/perch_shop/lang/en-gb.txt"
            ["lang"]=>
            string(5) "en-gb"
            ["translations":"PerchAPI_Lang":private]=>
            array(418) {
              ["lang"]=>
              string(5) "en-gb"
              ["Shop"]=>
              string(4) "Shop"
              ["Edit Product"]=>
              string(12) "Edit Product"
              ["Provider"]=>
              string(8) "Provider"
              ["Currencies"]=>
              string(10) "Currencies"
              ["Add currency"]=>
              string(12) "Add currency"
              ["Listing all currencies"]=>
              string(22) "Listing all currencies"
              ["Code"]=>
              string(4) "Code"
              ["Symbol"]=>
              string(6) "Symbol"
              ["Edit Currency"]=>
              string(13) "Edit Currency"
              ["Editing Currency ‘%s’"]=>
              string(25) "Editing Currency ‘%s’"
              ["Currency"]=>
              string(8) "Currency"
              ["Default currency"]=>
              string(16) "Default currency"
              ["Your currency has been successfully edited. Return to %slisting%s"]=>
              string(65) "Your currency has been successfully edited. Return to %slisting%s"
              ["Prices entered as"]=>
              string(17) "Prices entered as"
              ["Tax exclusive"]=>
              string(13) "Tax exclusive"
              ["Tax inclusive"]=>
              string(13) "Tax inclusive"
              ["Live site URL"]=>
              string(13) "Live site URL"
              ["Manage Products"]=>
              string(15) "Manage Products"
              ["Shipping"]=>
              string(8) "Shipping"
              ["Promotions"]=>
              string(10) "Promotions"
              ["Tax Bands"]=>
              string(9) "Tax Bands"
              ["Emails"]=>
              string(6) "Emails"
              ["Shop Dashboad"]=>
              string(13) "Shop Dashboad"
              ["Shipping methods"]=>
              string(16) "Shipping methods"
              ["Add shipping method"]=>
              string(19) "Add shipping method"
              ["Listing all shipping methods"]=>
              string(28) "Listing all shipping methods"
              ["Title"]=>
              string(5) "Title"
              ["Slug"]=>
              string(4) "Slug"
              ["Delete"]=>
              string(6) "Delete"
              ["excluding tax"]=>
              string(13) "excluding tax"
              ["Inactive"]=>
              string(8) "Inactive"
              ["Active"]=>
              string(6) "Active"
              ["Edit Shipping Method"]=>
              string(20) "Edit Shipping Method"
              ["Editing Shipping Method ‘%s’"]=>
              string(32) "Editing Shipping Method ‘%s’"
              ["Shipping method"]=>
              string(15) "Shipping method"
              ["Save"]=>
              string(4) "Save"
              ["or"]=>
              string(2) "or"
              ["Cancel"]=>
              string(6) "Cancel"
              ["including tax"]=>
              string(13) "including tax"
              ["Add tax band"]=>
              string(12) "Add tax band"
              ["Listing all tax bands"]=>
              string(21) "Listing all tax bands"
              ["Tax"]=>
              string(3) "Tax"
              ["Add promotion"]=>
              string(13) "Add promotion"
              ["Listing all promotions"]=>
              string(22) "Listing all promotions"
              ["Products"]=>
              string(8) "Products"
              ["Brands"]=>
              string(6) "Brands"
              ["Add product"]=>
              string(11) "Add product"
              ["Listing all products"]=>
              string(20) "Listing all products"
              ["No"]=>
              string(2) "No"
              ["Yes"]=>
              string(3) "Yes"
              ["Unlimited"]=>
              string(9) "Unlimited"
              ["In Stock"]=>
              string(8) "In Stock"
              ["Low Stock"]=>
              string(9) "Low Stock"
              ["Out of Stock"]=>
              string(12) "Out of Stock"
              ["More Stock Ordered"]=>
              string(18) "More Stock Ordered"
              ["Discontinued"]=>
              string(12) "Discontinued"
              ["Creating a New Product"]=>
              string(22) "Creating a New Product"
              ["Product"]=>
              string(7) "Product"
              ["Your product has been successfully created. Return to %sproduct listing%s"]=>
              string(73) "Your product has been successfully created. Return to %sproduct listing%s"
              ["Editing Product ‘%s’"]=>
              string(24) "Editing Product ‘%s’"
              ["SKU"]=>
              string(3) "SKU"
              ["Stock"]=>
              string(5) "Stock"
              ["Price"]=>
              string(5) "Price"
              ["Your product has been successfully edited. Return to %sproduct listing%s"]=>
              string(72) "Your product has been successfully edited. Return to %sproduct listing%s"
              ["Your shipping has been successfully edited. Return to %slisting%s"]=>
              string(65) "Your shipping has been successfully edited. Return to %slisting%s"
              ["Name"]=>
              string(4) "Name"
              ["Enabled"]=>
              string(7) "Enabled"
              ["Page %s of %s"]=>
              string(13) "Page %s of %s"
              ["Next"]=>
              string(4) "Next"
              ["Prev"]=>
              string(4) "Prev"
              ["Product Brands"]=>
              string(14) "Product Brands"
              ["Add brand"]=>
              string(9) "Add brand"
              ["Listing all brands"]=>
              string(18) "Listing all brands"
              ["Status"]=>
              string(6) "Status"
              ["Listing Product Files"]=>
              string(21) "Listing Product Files"
              ["Add file"]=>
              string(8) "Add file"
              ["Editing Files for ‘%s’"]=>
              string(26) "Editing Files for ‘%s’"
              ["Adding Product Files"]=>
              string(20) "Adding Product Files"
              ["Adding a New File"]=>
              string(17) "Adding a New File"
              ["File details"]=>
              string(12) "File details"
              ["Listing Product Variations"]=>
              string(26) "Listing Product Variations"
              ["Variant"]=>
              string(7) "Variant"
              ["Single"]=>
              string(6) "Single"
              ["Input"]=>
              string(5) "Input"
              ["Type"]=>
              string(4) "Type"
              ["Precendence"]=>
              string(11) "Precendence"
              ["Options"]=>
              string(7) "Options"
              ["Listing all options"]=>
              string(19) "Listing all options"
              ["Editing Option ‘%s’"]=>
              string(23) "Editing Option ‘%s’"
              ["Option"]=>
              string(6) "Option"
              ["Your product option has been successfully edited. Return to %soption listing%s"]=>
              string(78) "Your product option has been successfully edited. Return to %soption listing%s"
              ["Product Options"]=>
              string(15) "Product Options"
              ["Options for ‘%s’"]=>
              string(20) "Options for ‘%s’"
              [""]=>
              string(0) ""
              ["Size"]=>
              string(4) "Size"
              ["Colour"]=>
              string(6) "Colour"
              ["Add modifier"]=>
              string(12) "Add modifier"
              ["Add option"]=>
              string(10) "Add option"
              ["Edit Product Option"]=>
              string(19) "Edit Product Option"
              ["Values"]=>
              string(6) "Values"
              ["Centrally for the product"]=>
              string(25) "Centrally for the product"
              ["On individual variants"]=>
              string(22) "On individual variants"
              ["Listing Product Variants"]=>
              string(24) "Listing Product Variants"
              ["Listing all variants"]=>
              string(20) "Listing all variants"
              ["You should generate variants after making any changes to the options. %s"]=>
              string(72) "You should generate variants after making any changes to the options. %s"
              ["Creating a New Option"]=>
              string(21) "Creating a New Option"
              ["Your product option has been successfully created. Return to %soption listing%s"]=>
              string(79) "Your product option has been successfully created. Return to %soption listing%s"
              ["Edit Brand"]=>
              string(10) "Edit Brand"
              ["Editing Brand ‘%s’"]=>
              string(22) "Editing Brand ‘%s’"
              ["Brand"]=>
              string(5) "Brand"
              ["Editing Product Variant ‘%s’"]=>
              string(32) "Editing Product Variant ‘%s’"
              ["(%d in stock)"]=>
              string(13) "(%d in stock)"
              ["Listing all emails"]=>
              string(18) "Listing all emails"
              ["Subject"]=>
              string(7) "Subject"
              ["Creating a New Brand"]=>
              string(20) "Creating a New Brand"
              ["Your brand has been successfully created. Return to %s listing%s"]=>
              string(64) "Your brand has been successfully created. Return to %s listing%s"
              ["Listing all tax groups"]=>
              string(22) "Listing all tax groups"
              ["Add tax group"]=>
              string(13) "Add tax group"
              ["Tax groups"]=>
              string(10) "Tax groups"
              ["Tax locations"]=>
              string(13) "Tax locations"
              ["Add tax location"]=>
              string(16) "Add tax location"
              ["Listing all tax locations"]=>
              string(25) "Listing all tax locations"
              ["Standard rate"]=>
              string(13) "Standard rate"
              ["Reduced rate"]=>
              string(12) "Reduced rate"
              ["Edit Tax Location"]=>
              string(17) "Edit Tax Location"
              ["Editing Tax Location ‘%s’"]=>
              string(29) "Editing Tax Location ‘%s’"
              ["Tax location"]=>
              string(12) "Tax location"
              ["Creating a New Tax Location"]=>
              string(27) "Creating a New Tax Location"
              ["Sorry, that update was not successful."]=>
              string(38) "Sorry, that update was not successful."
              ["Your shipping has been successfully created. Return to %s listing%s"]=>
              string(67) "Your shipping has been successfully created. Return to %s listing%s"
              ["Edit Tax Group"]=>
              string(14) "Edit Tax Group"
              ["Creating a New Tax Group"]=>
              string(24) "Creating a New Tax Group"
              ["Tax group"]=>
              string(9) "Tax group"
              ["Editing Tax Group ‘%s’"]=>
              string(26) "Editing Tax Group ‘%s’"
              ["Locations"]=>
              string(9) "Locations"
              ["France"]=>
              string(6) "France"
              ["United Kingdom"]=>
              string(14) "United Kingdom"
              ["Location tax rates"]=>
              string(18) "Location tax rates"
              ["Manage Orders"]=>
              string(13) "Manage Orders"
              ["Orders"]=>
              string(6) "Orders"
              ["Customers"]=>
              string(9) "Customers"
              ["Listing all orders"]=>
              string(18) "Listing all orders"
              ["ID"]=>
              string(2) "ID"
              ["Date"]=>
              string(4) "Date"
              ["Customer"]=>
              string(8) "Customer"
              ["Total"]=>
              string(5) "Total"
              ["Order"]=>
              string(5) "Order"
              ["Unpaid"]=>
              string(6) "Unpaid"
              ["Paid"]=>
              string(4) "Paid"
              ["Processing"]=>
              string(10) "Processing"
              ["Dispatched"]=>
              string(10) "Dispatched"
              ["Cancelled"]=>
              string(9) "Cancelled"
              ["Failed"]=>
              string(6) "Failed"
              ["Declined"]=>
              string(8) "Declined"
              ["Mismatch"]=>
              string(8) "Mismatch"
              ["Refunded"]=>
              string(8) "Refunded"
              ["Partial refund"]=>
              string(14) "Partial refund"
              ["Change status to"]=>
              string(16) "Change status to"
              ["Update"]=>
              string(6) "Update"
              ["Viewing Order"]=>
              string(13) "Viewing Order"
              ["Received"]=>
              string(8) "Received"
              ["Gateway"]=>
              string(7) "Gateway"
              ["Customer ID"]=>
              string(11) "Customer ID"
              ["First name"]=>
              string(10) "First name"
              ["Last name"]=>
              string(9) "Last name"
              ["Email"]=>
              string(5) "Email"
              ["Billing address"]=>
              string(15) "Billing address"
              ["Shipping address"]=>
              string(16) "Shipping address"
              ["Item"]=>
              string(4) "Item"
              ["Qty"]=>
              string(3) "Qty"
              ["Created"]=>
              string(7) "Created"
              ["Payment failed"]=>
              string(14) "Payment failed"
              ["Desc"]=>
              string(4) "Desc"
              ["Edit Customer"]=>
              string(13) "Edit Customer"
              ["Editing Customer ‘%s’"]=>
              string(25) "Editing Customer ‘%s’"
              ["Home location"]=>
              string(13) "Home location"
              ["Update gamma"]=>
              string(12) "Update gamma"
              ["Gateways"]=>
              string(8) "Gateways"
              ["Gateway info"]=>
              string(12) "Gateway info"
              ["Creating a New Shipping Method"]=>
              string(30) "Creating a New Shipping Method"
              ["Set up some product options in the Options section in order to select them for this product."]=>
              string(92) "Set up some product options in the Options section in order to select them for this product."
              ["Product Details"]=>
              string(15) "Product Details"
              ["Variants"]=>
              string(8) "Variants"
              ["Files"]=>
              string(5) "Files"
              ["Default location"]=>
              string(16) "Default location"
              ["Detail"]=>
              string(6) "Detail"
              ["Country"]=>
              string(7) "Country"
              ["Source"]=>
              string(6) "Source"
              ["Tax evidence"]=>
              string(12) "Tax evidence"
              ["Order Details"]=>
              string(13) "Order Details"
              ["Tax Evidence"]=>
              string(12) "Tax Evidence"
              ["Order Tax Evidence"]=>
              string(18) "Order Tax Evidence"
              ["Viewing Order Tax Evidence"]=>
              string(26) "Viewing Order Tax Evidence"
              ["Rest of world"]=>
              string(13) "Rest of world"
              ["Access Shop"]=>
              string(11) "Access Shop"
              ["Edit Email"]=>
              string(10) "Edit Email"
              ["Editing Email ‘%s’"]=>
              string(22) "Editing Email ‘%s’"
              ["Your email has been successfully edited. Return to %slisting%s"]=>
              string(62) "Your email has been successfully edited. Return to %slisting%s"
              ["Listing all customers"]=>
              string(21) "Listing all customers"
              ["Generate variants"]=>
              string(17) "Generate variants"
              ["Groups"]=>
              string(6) "Groups"
              ["Tags"]=>
              string(4) "Tags"
              ["Listing Product Tags"]=>
              string(20) "Listing Product Tags"
              ["Editing Product Tags"]=>
              string(20) "Editing Product Tags"
              ["Editing Tags for ‘%s’"]=>
              string(25) "Editing Tags for ‘%s’"
              ["Order ID"]=>
              string(8) "Order ID"
              ["Trade prices entered as"]=>
              string(23) "Trade prices entered as"
              ["Product URL"]=>
              string(11) "Product URL"
              ["Export"]=>
              string(6) "Export"
              ["Please select"]=>
              string(13) "Please select"
              ["File type"]=>
              string(9) "File type"
              ["If you have a lot of content to import, you expect this to take a little while."]=>
              string(79) "If you have a lot of content to import, you expect this to take a little while."
              ["Format posts as"]=>
              string(15) "Format posts as"
              ["Import"]=>
              string(6) "Import"
              ["Order items"]=>
              string(11) "Order items"
              ["Customer addresses"]=>
              string(18) "Customer addresses"
              ["Exporting orders"]=>
              string(16) "Exporting orders"
              ["Export options"]=>
              string(14) "Export options"
              ["Save to"]=>
              string(7) "Save to"
              ["Download directly"]=>
              string(17) "Download directly"
              ["Save Changes"]=>
              string(12) "Save Changes"
              ["Between"]=>
              string(7) "Between"
              ["and"]=>
              string(3) "and"
              ["Export requires the PHP PDO library for connecting to your database."]=>
              string(68) "Export requires the PHP PDO library for connecting to your database."
              ["Reporting currency"]=>
              string(18) "Reporting currency"
              ["Invoice number format"]=>
              string(21) "Invoice number format"
              ["Test"]=>
              string(4) "Test"
              ["Germany"]=>
              string(7) "Germany"
              ["Shop Dashboard"]=>
              string(14) "Shop Dashboard"
              ["Order statuses"]=>
              string(14) "Order statuses"
              ["Statuses"]=>
              string(8) "Statuses"
              ["Add status"]=>
              string(10) "Add status"
              ["Listing all statuses"]=>
              string(20) "Listing all statuses"
              ["Key"]=>
              string(3) "Key"
              ["Index"]=>
              string(5) "Index"
              ["Edit Order Status"]=>
              string(17) "Edit Order Status"
              ["Editing Status ‘%s’"]=>
              string(23) "Editing Status ‘%s’"
              ["Your status has been successfully edited. Return to %slisting%s"]=>
              string(63) "Your status has been successfully edited. Return to %slisting%s"
              ["Creating a New Order Status"]=>
              string(27) "Creating a New Order Status"
              ["Your status has been successfully created. Return to %s listing%s"]=>
              string(65) "Your status has been successfully created. Return to %s listing%s"
              ["Delete Order Status"]=>
              string(19) "Delete Order Status"
              ["Permanently delete this item."]=>
              string(29) "Permanently delete this item."
              ["Deleting ‘%s’"]=>
              string(17) "Deleting ‘%s’"
              ["Are you sure you wish to delete this?"]=>
              string(37) "Are you sure you wish to delete this?"
              ["Creating a New Currency Method"]=>
              string(30) "Creating a New Currency Method"
              ["Your currency has been successfully created. Return to %s listing%s"]=>
              string(67) "Your currency has been successfully created. Return to %s listing%s"
              ["Delete Currency"]=>
              string(15) "Delete Currency"
              ["Delete Tag Group"]=>
              string(16) "Delete Tag Group"
              ["Delete Tax Location"]=>
              string(19) "Delete Tax Location"
              ["Delete Shipping Method"]=>
              string(22) "Delete Shipping Method"
              ["Editing File ‘%s’"]=>
              string(21) "Editing File ‘%s’"
              ["Path"]=>
              string(4) "Path"
              ["File size"]=>
              string(9) "File size"
              ["Deleting Product Files"]=>
              string(22) "Deleting Product Files"
              ["Free shipping"]=>
              string(13) "Free shipping"
              ["Buy X get Y free"]=>
              string(16) "Buy X get Y free"
              ["Discount by fixed"]=>
              string(17) "Discount by fixed"
              ["Discount by percent"]=>
              string(19) "Discount by percent"
              ["Discount to fixed"]=>
              string(17) "Discount to fixed"
              ["Discount subtotal by fixed"]=>
              string(26) "Discount subtotal by fixed"
              ["Discount subtotal by percent"]=>
              string(28) "Discount subtotal by percent"
              ["Edit Promotion"]=>
              string(14) "Edit Promotion"
              ["Creating a New Promotion"]=>
              string(24) "Creating a New Promotion"
              ["Promotion"]=>
              string(9) "Promotion"
              ["before tax"]=>
              string(10) "before tax"
              ["Editing Promotion ‘%s’"]=>
              string(26) "Editing Promotion ‘%s’"
              ["Delete Promotion"]=>
              string(16) "Delete Promotion"
              ["No shipping"]=>
              string(11) "No shipping"
              ["Discounts"]=>
              string(9) "Discounts"
              ["Methods"]=>
              string(7) "Methods"
              ["Zones"]=>
              string(5) "Zones"
              ["Shipping zones"]=>
              string(14) "Shipping zones"
              ["Add shipping zone"]=>
              string(17) "Add shipping zone"
              ["Listing all shipping zones"]=>
              string(26) "Listing all shipping zones"
              ["Edit Shipping Zone"]=>
              string(18) "Edit Shipping Zone"
              ["Creating a New Shipping Zone"]=>
              string(28) "Creating a New Shipping Zone"
              ["Shipping zone"]=>
              string(13) "Shipping zone"
              ["Your shipping zone has been successfully edited. Return to %slisting%s"]=>
              string(70) "Your shipping zone has been successfully edited. Return to %slisting%s"
              ["Editing Shipping Zone ‘%s’"]=>
              string(30) "Editing Shipping Zone ‘%s’"
              ["Default zone"]=>
              string(12) "Default zone"
              ["Delete Shipping Zone"]=>
              string(20) "Delete Shipping Zone"
              ["Available"]=>
              string(9) "Available"
              ["Invoice #"]=>
              string(9) "Invoice #"
              ["Invoice"]=>
              string(7) "Invoice"
              ["Add email"]=>
              string(9) "Add email"
              ["Creating a New Email"]=>
              string(20) "Creating a New Email"
              ["Your email has been successfully created. Return to %s listing%s"]=>
              string(64) "Your email has been successfully created. Return to %s listing%s"
              ["Delete Email"]=>
              string(12) "Delete Email"
              ["Before amount"]=>
              string(13) "Before amount"
              ["After amount"]=>
              string(12) "After amount"
              ["Countries"]=>
              string(9) "Countries"
              ["Your tax group has been successfully edited. Return to %slisting%s"]=>
              string(66) "Your tax group has been successfully edited. Return to %slisting%s"
              ["Your tax group has been successfully created. Return to %s listing%s"]=>
              string(68) "Your tax group has been successfully created. Return to %s listing%s"
              ["Add %sperch_members%s and %sperch_shop%s to your %sconfig/apps.php%s file."]=>
              string(74) "Add %sperch_members%s and %sperch_shop%s to your %sconfig/apps.php%s file."
              ["%sCreate a category set%s for your products."]=>
              string(44) "%sCreate a category set%s for your products."
              ["%sEnable at least one currency%s to sell in."]=>
              string(44) "%sEnable at least one currency%s to sell in."
              ["%sConfigure settings%s for currencies and how prices are entered."]=>
              string(65) "%sConfigure settings%s for currencies and how prices are entered."
              ["%sCreate a home tax location%s for tax calculation purposes."]=>
              string(60) "%sCreate a home tax location%s for tax calculation purposes."
              ["%sCreate a default tax location%s for tax calculation purposes."]=>
              string(63) "%sCreate a default tax location%s for tax calculation purposes."
              ["%sCreate at least one tax group%s to assign your products and shipping to."]=>
              string(74) "%sCreate at least one tax group%s to assign your products and shipping to."
              ["%sCreate at least one shipping zone%s to define where in the world you deliver to."]=>
              string(82) "%sCreate at least one shipping zone%s to define where in the world you deliver to."
              ["%sCreate at least one shipping method%s by which products can be shipped."]=>
              string(73) "%sCreate at least one shipping method%s by which products can be shipped."
              ["%sCreate one or more brands%s to assign products to."]=>
              string(52) "%sCreate one or more brands%s to assign products to."
              ["%sAdd some products!%s"]=>
              string(22) "%sAdd some products!%s"
              ["All done! %sAdd some products!%s"]=>
              string(32) "All done! %sAdd some products!%s"
              ["For"]=>
              string(3) "For"
              ["Manage your shop"]=>
              string(16) "Manage your shop"
              ["Format"]=>
              string(6) "Format"
              ["Default"]=>
              string(7) "Default"
              ["Xero"]=>
              string(4) "Xero"
              ["Additional information"]=>
              string(22) "Additional information"
              ["Once you have some orders, they will show up here!"]=>
              string(50) "Once you have some orders, they will show up here!"
              ["Your promotion has been successfully created. Return to %s listing%s"]=>
              string(68) "Your promotion has been successfully created. Return to %s listing%s"
              ["Priority"]=>
              string(8) "Priority"
              ["Create new brands"]=>
              string(17) "Create new brands"
              ["Edit brands"]=>
              string(11) "Edit brands"
              ["Delete brands"]=>
              string(13) "Delete brands"
              ["Create new currencies"]=>
              string(21) "Create new currencies"
              ["Delete currencies"]=>
              string(17) "Delete currencies"
              ["Edit currencies"]=>
              string(15) "Edit currencies"
              ["Create new customers"]=>
              string(20) "Create new customers"
              ["Delete customers"]=>
              string(16) "Delete customers"
              ["Edit customers"]=>
              string(14) "Edit customers"
              ["Create new emails"]=>
              string(17) "Create new emails"
              ["Delete emails"]=>
              string(13) "Delete emails"
              ["Create new product options"]=>
              string(26) "Create new product options"
              ["Edit product options"]=>
              string(20) "Edit product options"
              ["Access orders"]=>
              string(13) "Access orders"
              ["Edit orders"]=>
              string(11) "Edit orders"
              ["Access Products"]=>
              string(15) "Access Products"
              ["Create new products"]=>
              string(19) "Create new products"
              ["Edit products"]=>
              string(13) "Edit products"
              ["Delete products"]=>
              string(15) "Delete products"
              ["Create new promotions"]=>
              string(21) "Create new promotions"
              ["Edit promotions"]=>
              string(15) "Edit promotions"
              ["Delete promotions"]=>
              string(17) "Delete promotions"
              ["Create new shipping methods"]=>
              string(27) "Create new shipping methods"
              ["Delete shipping methods"]=>
              string(23) "Delete shipping methods"
              ["Edit shipping methods"]=>
              string(21) "Edit shipping methods"
              ["Create new order statuses"]=>
              string(25) "Create new order statuses"
              ["Delete order statuses"]=>
              string(21) "Delete order statuses"
              ["Edit order statuses"]=>
              string(19) "Edit order statuses"
              ["Create new tax bands"]=>
              string(20) "Create new tax bands"
              ["Delete tax bands"]=>
              string(16) "Delete tax bands"
              ["Edit tax bands"]=>
              string(14) "Edit tax bands"
              ["Create new tax groups"]=>
              string(21) "Create new tax groups"
              ["Delete tax groups"]=>
              string(17) "Delete tax groups"
              ["Edit tax groups"]=>
              string(15) "Edit tax groups"
              ["Create new tax locations"]=>
              string(24) "Create new tax locations"
              ["Delete tax locations"]=>
              string(20) "Delete tax locations"
              ["Edit tax locations"]=>
              string(18) "Edit tax locations"
              ["Your brand has been successfully edited. Return to %slisting%s"]=>
              string(62) "Your brand has been successfully edited. Return to %slisting%s"
              ["Your promotion has been successfully edited. Return to %slisting%s"]=>
              string(66) "Your promotion has been successfully edited. Return to %slisting%s"
              ["Shop dashboard"]=>
              string(14) "Shop dashboard"
              ["Are you sure?"]=>
              string(13) "Are you sure?"
              ["Creating a new tax location"]=>
              string(27) "Creating a new tax location"
              ["Your tax location has been successfully edited. Return to %slisting%s"]=>
              string(69) "Your tax location has been successfully edited. Return to %slisting%s"
              ["Your tax location has been successfully created. Return to %s listing%s"]=>
              string(71) "Your tax location has been successfully created. Return to %s listing%s"
              ["Editing tax location ‘%s’"]=>
              string(29) "Editing tax location ‘%s’"
              ["Sorted ascending"]=>
              string(16) "Sorted ascending"
              ["Sorted descending"]=>
              string(17) "Sorted descending"
              ["Home"]=>
              string(4) "Home"
              ["Away"]=>
              string(4) "Away"
              ["Your shipping zone has been successfully created. Return to %s listing%s"]=>
              string(72) "Your shipping zone has been successfully created. Return to %s listing%s"
              ["Pagination"]=>
              string(10) "Pagination"
              ["First page"]=>
              string(10) "First page"
              ["First"]=>
              string(5) "First"
              ["Previous page"]=>
              string(13) "Previous page"
              ["Page %d"]=>
              string(7) "Page %d"
              ["Page %d, current page"]=>
              string(21) "Page %d, current page"
              ["%d, current page"]=>
              string(16) "%d, current page"
              ["Next page"]=>
              string(9) "Next page"
              ["Last page"]=>
              string(9) "Last page"
              ["Last"]=>
              string(4) "Last"
              ["Creating a new product"]=>
              string(22) "Creating a new product"
              ["Editing product ‘%s’"]=>
              string(24) "Editing product ‘%s’"
              ["Editing product variant ‘%s’"]=>
              string(32) "Editing product variant ‘%s’"
              ["Adding a new file"]=>
              string(17) "Adding a new file"
              ["Editing file ‘%s’"]=>
              string(21) "Editing file ‘%s’"
              ["Your product tags have been successfully edited."]=>
              string(48) "Your product tags have been successfully edited."
              ["Viewing order"]=>
              string(13) "Viewing order"
              ["Invoice46"]=>
              string(9) "Invoice46"
              ["Viewing order tax evidenc"]=>
              string(25) "Viewing order tax evidenc"
              ["Viewing order tax evidence"]=>
              string(26) "Viewing order tax evidence"
              ["Add customer"]=>
              string(12) "Add customer"
              ["Your customer has been successfully edited. Return to %slisting%s"]=>
              string(65) "Your customer has been successfully edited. Return to %slisting%s"
              ["Creating a New Customer"]=>
              string(23) "Creating a New Customer"
              ["Sales"]=>
              string(5) "Sales"
              ["Listing all sales"]=>
              string(17) "Listing all sales"
              ["Add sale"]=>
              string(8) "Add sale"
              ["Edit Sale"]=>
              string(9) "Edit Sale"
              ["Creating a new sale"]=>
              string(19) "Creating a new sale"
              ["Sale"]=>
              string(4) "Sale"
              ["Your sale has been successfully created. Return to %s listing%s"]=>
              string(63) "Your sale has been successfully created. Return to %s listing%s"
              ["Editing sale ‘%s’"]=>
              string(21) "Editing sale ‘%s’"
              ["Your sale has been successfully edited. Return to %slisting%s"]=>
              string(61) "Your sale has been successfully edited. Return to %slisting%s"
              ["Delete Sale"]=>
              string(11) "Delete Sale"
              ["Use sale price"]=>
              string(14) "Use sale price"
              ["Listing all countries"]=>
              string(21) "Listing all countries"
              ["Add country"]=>
              string(11) "Add country"
              ["In EU"]=>
              string(5) "In EU"
              ["ISO code"]=>
              string(8) "ISO code"
              ["Edit country"]=>
              string(12) "Edit country"
              ["Creating a new currency"]=>
              string(23) "Creating a new currency"
              ["Editing country ‘%s’"]=>
              string(24) "Editing country ‘%s’"
              ["Your country has been successfully edited. Return to %slisting%s"]=>
              string(64) "Your country has been successfully edited. Return to %slisting%s"
              ["ISO2 code"]=>
              string(9) "ISO2 code"
              ["ISO3 code"]=>
              string(9) "ISO3 code"
              ["ISO number"]=>
              string(10) "ISO number"
              ["Creating a new country"]=>
              string(22) "Creating a new country"
              ["Editing currency ‘%s’"]=>
              string(25) "Editing currency ‘%s’"
              ["Invoice1"]=>
              string(8) "Invoice1"
              ["Invoice2"]=>
              string(8) "Invoice2"
              ["Invoice3"]=>
              string(8) "Invoice3"
              ["Invoice5"]=>
              string(8) "Invoice5"
              ["Invoice10"]=>
              string(9) "Invoice10"
              ["Invoice12"]=>
              string(9) "Invoice12"
            }
            ["to_add":"PerchAPI_Lang":private]=>
            array(0) {
            }
          }
        }
        ["db":protected]=>
        NULL
        ["details":protected]=>
        array(16) {
          ["productID"]=>
          string(1) "2"
          ["title"]=>
          string(12) "Alaska bilde"
          ["sku"]=>
          string(8) "01asd-PP"
          ["productSlug"]=>
          NULL
          ["stock_level"]=>
          string(1) "1"
          ["parentID"]=>
          string(1) "1"
          ["productVariantDesc"]=>
          string(11) "Print Paper"
          ["productOrder"]=>
          string(1) "1"
          ["productHasVariants"]=>
          string(1) "0"
          ["productStockOnParent"]=>
          string(1) "0"
          ["productDynamicFields"]=>
          string(273) "{"price":{"44":"50","_default":"50"},"sale_price":{"44":"50","_default":"50"},"trade_price":{"44":"50","_default":"50"},"on_sale":null,"tax_group":"1","stock_status":"1","requires_shipping":"1","weight":"500","width":"500","height":"500","depth":"500","stock_location":"0"}"
          ["productTemplate"]=>
          string(12) "product.html"
          ["productCreated"]=>
          string(19) "2017-07-19 08:44:22"
          ["productUpdated"]=>
          string(19) "2017-08-17 14:48:17"
          ["productDeleted"]=>
          NULL
          ["productStatus"]=>
          string(1) "1"
        }
        ["optimize_index":protected]=>
        bool(true)
        ["can_log_resources":protected]=>
        bool(true)
        ["prefix_vars"]=>
        bool(true)
      }
      ["qty"]=>
      string(1) "1"
      ["id"]=>
      string(1) "2"
    }
  }
  ["shipping_id"]=>
  string(1) "1"
  ["shipping_method"]=>
  string(17) "Standard Delivery"
  ["shipping_tax"]=>
  string(4) "4.00"
  ["shipping_tax_formatted"]=>
  string(7) "€4.00"
  ["shipping_tax_rate"]=>
  string(5) "25.00"
  ["shipping_with_tax"]=>
  string(5) "20.00"
  ["shipping_with_tax_formatted"]=>
  string(8) "€20.00"
  ["shipping_without_tax"]=>
  string(5) "16.00"
  ["shipping_without_tax_formatted"]=>
  string(8) "€16.00"
  ["total_items"]=>
  string(5) "40.00"
  ["total_items_formatted"]=>
  string(8) "€40.00"
  ["total_items_tax"]=>
  string(5) "10.00"
  ["total_items_tax_formatted"]=>
  string(8) "€10.00"
  ["total_shipping"]=>
  string(5) "16.00"
  ["total_shipping_formatted"]=>
  string(8) "€16.00"
  ["total_shipping_tax"]=>
  string(4) "4.00"
  ["total_shipping_tax_formatted"]=>
  string(7) "€4.00"
  ["total_items_with_shipping"]=>
  string(5) "56.00"
  ["total_items_with_shipping_formatted"]=>
  string(8) "€56.00"
  ["total_tax"]=>
  string(5) "14.00"
  ["total_tax_formatted"]=>
  string(8) "€14.00"
  ["total_items_discount"]=>
  string(4) "0.00"
  ["total_items_discount_formatted"]=>
  string(7) "€0.00"
  ["total_items_tax_discount"]=>
  string(4) "0.00"
  ["total_items_tax_discount_formatted"]=>
  string(7) "€0.00"
  ["total_items_discounted"]=>
  string(5) "40.00"
  ["total_items_discounted_formatted"]=>
  string(8) "€40.00"
  ["total_items_discounted_with_tax"]=>
  string(5) "50.00"
  ["total_items_discounted_with_tax_formatted"]=>
  string(8) "€50.00"
  ["total_shipping_discount"]=>
  string(4) "0.00"
  ["total_shipping_discount_formatted"]=>
  string(7) "€0.00"
  ["total_shipping_tax_discount"]=>
  string(4) "0.00"
  ["total_shipping_tax_discount_formatted"]=>
  string(7) "€0.00"
  ["total_tax_discount"]=>
  string(4) "0.00"
  ["total_tax_discount_formatted"]=>
  string(7) "€0.00"
  ["total_discounts"]=>
  string(4) "0.00"
  ["total_discounts_formatted"]=>
  string(7) "€0.00"
  ["total_discounts_with_tax"]=>
  string(4) "0.00"
  ["total_discounts_with_tax_formatted"]=>
  string(7) "€0.00"
  ["grand_total"]=>
  string(5) "70.00"
  ["grand_total_formatted"]=>
  string(8) "€70.00"
  ["shipping_weight"]=>
  string(6) "500.00"
  ["tax_rate_totals"]=>
  array(1) {
    [0]=>
    array(11) {
      ["exchange_rate"]=>
      string(7) "unknown"
      ["tax_rate"]=>
      string(5) "25.00"
      ["tax_rate_formatted"]=>
      string(4) "25 %"
      ["total_tax"]=>
      string(5) "14.00"
      ["total_tax_formatted"]=>
      string(8) "€14.00"
      ["total_value"]=>
      string(5) "56.00"
      ["total_value_formatted"]=>
      string(8) "€56.00"
      ["reporting_tax"]=>
      string(5) "14.00"
      ["reporting_tax_formatted"]=>
      string(8) "€14.00"
      ["reporting_value"]=>
      string(5) "56.00"
      ["reporting_value_formatted"]=>
      string(8) "€56.00"
    }
  }
  ["currency_id"]=>
  string(2) "44"
  ["currency_code"]=>
  string(3) "EUR"
  ["currency_name"]=>
  string(4) "Euro"
  ["currency_symbol"]=>
  string(3) "€"
}
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, no idea. It certainly should update the stock values when displaying or updating the cart. Does updating the cart help?