hi in the home page i want to receive the images and some other attributes of all variants of a configurable product in homepage in velocity theme . any idea how can i get that . thanks
Sample code to do so on blade:
@if (WebkulProductHelpersProductType::hasVariants($product->type))
@foreach($product->variants as $key => $variant)
$variantImage = $variant->images;
@endforeach
@endif
@farshadff Hope this helps.
@dejavuejs thanks mate i will let you know the result as soon as i try that . thanks a lot <3
Hello @farshadff
You can also get product variants using relationship.
$product->variants
Return empty collection in case of no variant.
Feel free to reopen this if you still have any query.
Most helpful comment
Sample code to do so on blade:
@if (WebkulProductHelpersProductType::hasVariants($product->type))
@foreach($product->variants as $key => $variant)
$variantImage = $variant->images;
@endforeach
@endif
@farshadff Hope this helps.