Filter product types for store or image view
By default, Sunshine Photo Cart shows images in your client photo gallery with an add to cart button – I call this the image-first shopping experience. However, one of the most requested features was a way to allow customers to shop using a product-first experience. This is called the Store View – customers are shown all the categories and products and then can assign which images they want for each product. This can make the purchase experience faster for customers who know they specifically want to buy (3) 8×10 photos and need to select which photos they want.
The store view is also the only way for customers to shop for multi-image products.
By default, these product types appear in the image-first experience:
- download
- package
By default, these product types appear in the store or product-first experience:
- download
- package
- multi-image
Using the “sunshine_allowed_product_types_for_image” and “sunshine_allowed_product_types_for_store” filters, we can change which product types are available. In the following code snippet, we remove packages from being shown in the image-first experience:
add_filter( 'sunshine_allowed_product_types_for_image', function( $allowed_types ) {
$key = array_search( 'package', $allowed_types );
if ( $key !== false ) {
unset( $allowed_types[ $key ] );
}
return $allowed_types;
});
Learn how to add this custom code to your WordPress website
Still need help?
If you have not yet found your answer in the documentation articles, please contact support