1

I am facing a problem in which i need to retrieve the base sku of a product on the modified sku of that product which has the custom option sku suffixed.

for example> base product "shirt", sku = 1234, "red shirt"= 1234-12 how can i get the sku of the base "shirt" (1234) from the "red shirt"(1234-12) please take note that this isnt a case of "configurable products". and there doesnt exist in parent child relationship between the original and sub products(and parents are returned as "null"

1 Answer 1

0

Am I right in assuming that you're trying to get the SKU from a quote, cart or order item and it's returning the SKU in the extended format you mention? That's normal if you're just using $cartItem->getSku(), you need to get the product from the cart item and then get the SKU from that e.g.

$cartItem->getProduct()->getSku()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.