Hi :wave::skin-tone-5: This is my first time usin...
# support
d
Hi 👋🏾 This is my first time using Solidus and I’m encountering some issues when I change the currency to GHS( Ghana Cedis) in my `config/initializers/spree.rb`: Spree.config do |config| config.currency = ‘GHS’ end When a user adds a product to the cart the error message is ” Price not valid” I noticed when it’s changed back to ‘USD’, it works perfectly. What could be the issue? Please I need help. Also, has anyone implemented any payment method aside the supported gateways? I would need some guidelines for implementing other payment methods like Paystack or LemonSqueezy. I tried using the solidus paystack gem ( https://github.com/JuliusNM/solidus_paystack) but I run into gem not found issues. Thanks
j
Hey Derrick, If you go to the product in admin you'll notice a "prices" tab, you need to set the price for each currency you'd like to allow checkout in. If you set the store to only work in GHS, you'll just need to ensure that each product had a GHS price, then it should work all goodie
if you do get to the point where you want to allow multiple currencies, there is a pricing options class you can modify to allow changing currency based on the request or whatever logic around that. I sell in USD & EUR but with the same value, so i have a rake task which loops through products and creates a euro price for them like such:
Copy code
variants.each do |variant|
        Spree::Price.find_or_create_by(
            variant_id: variant.id,
            amount: variant.price,
            currency: 'EUR'
        )
      end
👍 1
yours might look like:
Copy code
variants.each do |variant|
        Spree::Price.find_or_create_by(
            variant_id: variant.id,
            amount: variant.price,
            currency: 'GHS'
        )
      end
👍 2
for the payment methods it's a bit above my pay grade 😅
😁 1
k
maybe that extension is only on GitHub and not on RubyGems, you can try using that version with:
Copy code
gem 'solidus_paystack', github: 'JuliusNM/solidus_paystack'
I’m afraid some change is needed though because it’s only compatible with Solidus <4: https://github.com/JuliusNM/solidus_paystack/blob/main/solidus_paystack.gemspec#L33C1-L33C58
d
@kennyadsl Thank you so much. You’re right, I run into some compatibility error: Fetching https://github.com/JuliusNM/solidus_paystack.git Fetching gem metadata from https://rubygems.org/......... Resolving dependencies... Could not find compatible versions Because every version of solidus_paystack depends on Ruby ~> 2.5 and Gemfile depends on solidus_paystack >= 0, Ruby ~> 2.5 is required. So, because current Ruby version is = 3.2.2. I happen to know Julius so I reached out to him, hopefully, he is able to help with the Paystack integration.
k
Nice, you can always fork the gem and fix what you need
👍 1
d
hi, @Jacob Penn thank you so much for taking the time to guide me. I did navigate to the admin and all product prices are in GHS. Error still appears: https://www.loom.com/share/cabcb81f836f46d2b5dd95c6a2a991d6?sid=160de755-b3ca-411c-bb2a-dbb466de29d5
k
@Derrick Amenuve Can you try creating a new order in an incognito tab? I’m afraid your current order started as USD and now is not accepting GHS prices anymore.
👍 2
j
Yeah once an order is miffed it can be a bit hard to get it off an account, you can set expiry on the orders through the spree config, I added another method to our cart page which says empty cart but instead of just emptying, it destroys the current order for the user, found it very helpful for testing
👍 1
d
@kennyadsl Thank you so much, I deleted the product and added a new product then tried to order in Incognito mode and it worked. Once again, thanks.
👍 1