Nov 15th 2019 #1 Hello, Is it possible to use the PerchShop_Products to find a product using the slug or any other field, instead of searching for the ID like this example: Code $Products = new PerchShop_Products(); $newProduct = $Products->find($product['id']); Can we use the ->find for looking for the slug?
Nov 15th 2019 #2 You should be able to use Code $Products = new PerchShop_Products(); $newProduct = $Products->get_one_by('productSlug', $product['slug']); You can check the PerchFactoryClass.php file, in the core folder, for a list of all available methods
Nov 16th 2019 #4 It worked. I now used the SKU to check if the product already exists, if not I import the product. Code foreach($result['data'] as $productData){ $Products = new PerchShop_Products(); $newProduct = $Products->get_one_by('sku', $productData['productcode']); if (!$productData['productcode'] == $newProduct) { # } }