Hi all, is anyone familiar with Solidus Subscripti...
# support
g
Hi all, is anyone familiar with Solidus Subscriptions? https://github.com/solidusio-contrib/solidus_subscriptions If I make a product subscribable, customers have to subscribe to the product and lose the option of simply purchasing the product without committing to a subscription. Once I hit "Add to Cart" without actually filling in the subscription fields, I get the error -
ActiveRecord::RecordInvalid in Spree::OrdersController#populate
"Validation failed: Quantity must be greater than 0, Interval length is not a number."
I want the customer to have the choice to either subscribe or make a one-off purchase.
n
you could in theory make two versions of the same item - once for subscription and the other for one off purchases
g
Hi @Naoki Mi thank you for your input. I thought the same, but having two entires for the identical product raises so many follow up issues (user-friendliness, api advertising products online, product filter, seo duplicated content, duplicated SKUs, etc.). I don't think this is expected behaviour either.
n
you would have two products on the backend, and you could use some event listenetrs to switch up based on selection I agree that its probably not intended behaviour, but could be a workaround
g
No, we rather write the entire gem from scratch to fit our needs before committing to that complexity for such basic behaviour 😅 ... but it is a valid suggestion! Thank you!
s
@Georg Keferböck Whether or not a subscription item is created is based on the parameters sent to the populate action IIRC - to stop the subscribable product from attempting to create a subscription, I think you just need to stop using/disable subscription_line_item related fields on the product page
Subscription line items are handled here: https://github.com/solidusio-contrib/solidus_subscriptions/blob/master/lib/decorators/frontend/controllers/solidus_subscriptions/spree/orders_controller/create_subscription_line_items.rb So you just need to not send the ‘subscription_line_item’ param in the populate request
g
Hi @Sean Denny (he/him) - thank you so much for the input. Will take a look tomorrow!