PHP error

  • I am getting the following PHP error when adding products to the cart which have variants. Am I doing something Wrong?


    The each() function is deprecated. This message will be suppressed on further calls in MY URL on line 208


    I'm using the example add to cart form for the perch docs and PHP version 7.3.15.


  • It’s not an error it’s a warning and shouldn’t prevent your code from executing. The each function was deprecated in 7.2 so yes running 7.3 and using each() will generate this warning. That said the only place I see each being used is in the Guzzle vendor files for the Dropbox and S3 plugins.


    are you using any other custom apps, fieldtypes etc?

  • I have fields within the form which use cart-property="message" so the customer can include text with their order, not sure if this is a custom fieldtype though?


    Yes, you are correct is saying the code shouldn't be executing, it is adding the to the cart successfully.


    Currently the variant adds to the cart per item, is there a way of adding a set price variant, for example if a customer checked the variant checkbox it would add £50 to the order whether the customer wants 30 or 100 items?