.
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
using PartSource.Automation.Models;
|
||||
using PartSource.Data;
|
||||
using PartSource.Data.Models;
|
||||
using PartSource.Services.Integrations;
|
||||
using Ratermania.Shopify.Entities;
|
||||
using Ratermania.Shopify;
|
||||
using Ratermania.Shopify.Resources;
|
||||
using Ratermania.Shopify.Resources.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -49,7 +50,7 @@ namespace PartSource.Automation.Jobs
|
||||
{
|
||||
if (product.Variants.Length > 0)
|
||||
{
|
||||
ProductVariant variant = product.Variants[0];
|
||||
Variant variant = product.Variants[0];
|
||||
PartPrice partPrice = _partSourceContext.PartPrices.Where(p => p.SKU == variant.Sku).FirstOrDefault();
|
||||
|
||||
if (partPrice == null || !partPrice.Your_Price.HasValue || !partPrice.Compare_Price.HasValue)
|
||||
@@ -64,6 +65,8 @@ namespace PartSource.Automation.Jobs
|
||||
product.Variants[0].Price = partPrice.Your_Price.Value;
|
||||
product.Variants[0].CompareAtPrice = partPrice.Compare_Price.Value;
|
||||
|
||||
product.PublishedAt = partPrice.Active.ToUpperInvariant() == "Y" ? DateTime.Now : default;
|
||||
|
||||
Metafield metafield = new Metafield
|
||||
{
|
||||
Namespace = "Pricing",
|
||||
@@ -76,6 +79,7 @@ namespace PartSource.Automation.Jobs
|
||||
|
||||
try
|
||||
{
|
||||
await _shopifyClient.Metafields.Add(metafield);
|
||||
await _shopifyClient.Products.Update(product);
|
||||
|
||||
updateCount++;
|
||||
|
||||
Reference in New Issue
Block a user