Skip to content

Instantly share code, notes, and snippets.

View tiagomatos's full-sized avatar

Tiago Matos tiagomatos

View GitHub Profile
// Step 1: Create a virtual Product Called "Envio a Cobranza" with two Variants: Portugal/Spain
// Step 2: Get the Product and variants IDs
// Step 3: replace the following variables with the Product ID (in the product settings URL), Variant Ids (see tip below) and Manual Payment ID (In the payment method URL in the admin panel)
var productId = "2388937"
var portugalId = "1883423"
var spainId = "1883423"
var paymentId = "136033"
/* TIP: To get the variant ID of the countries I added this code to the product page and checked the console
class Date
def to_words
if self == Date.today
"Today"
elsif self <= Date.today - 1
if self == Date.today - 1
"Yesterday"
elsif ((Date.today - 7)..(Date.today - 1)).include?(self)
"Last #{self.strftime("%A")}"
elsif ((Date.today - 14)..(Date.today - 8)).include?(self)