Spartacus Promotion Service getProductPromotionForEntry - spartacus-storefront

Im using Spartacus 1.5 version and used the promotionService.getProductPromotionForEntry in the cart page. I have a appliedPromotion for my item but it will return empty array. may I know what is to consider to have a applied promotions?

Related

Shopify - Validate cart items at checkout?

A product in my store (e.g. a fine art print) has a base price of £20 and it has multiple customizable options (size / framing) that are added as additional items to the cart (e.g. Small [£0] / Medium [+£10] / Large [+£20] or Unframed [£0] / Framed [+£10] )
I have to do it this way because some products have more than 3 variant options (Shopify only supports 3)
These additional items that represent the customization options for the base product are added when the customer adds the base product to cart, but the additional products representing options are hidden to the customer in the cart.
At checkout however all is revealed, the base product appears with 2 additional items along with their additional prices. Not ideal but OK!
However, it occurred to me that there's nothing stopping a tech-savvy nerd from grabbing the variant ID of the additional items and sending a POST request to /cart/update.js that removes them from the order during checkout.
The customer just reloads the checkout page and they've just halved the price they have to pay!
I need to prevent this from happening.
I don't suppose there's a way to validate all the items in the cart when the customer requests the checkout page?
If that's not possible, how do other Shopify stores get around this issue?
If you are on the Shopify Plus plan there are two things you can do:
During checkout validation - use Script Editor to check the cart contents and if it's invalid, set the base product quantity and additional products to 0. This will prevent customers from checking out.
Post checkout validation - use Shopify Flow to cancel the order after it's placed and if it's invalid
But that's a lot of development, especially when you are not familiar with it, it will be hard to go through and make it work as expected (covering all edge cases). It's possible to create a such script but analysis of all possible scenarios and writing a code for it will take some time. If I were you I would consider an app that creates bundles as a single item. Adding such a bundle to the cart takes a few seconds to process as the app is making some admin API calls in the background but it solves your problem. I cannot promote any paid solution on StackOverflow but you will easily find something - there are plenty of solutions in the app store.
The decision comes down to your estimation + possible change requests and fixes vs. the cost of the app on a yearly basis

Spartacus perform search without updating the products in product list page

We have a custom filter functionality which involves adding filters in bulk and applying them at the end. For this, every time a user clicks a breadcrumb, a search call will be performed to update the current list of facets but without updating the product list on PLP. The PLP will be updated only when the user clicks ‘apply’.
The search call needed to update the facet list is done at the moment trough a http call to the search endpoint but is there a better way to do this to benefit more of spartacus (in terms of caching for example)?
Should all the layers of the backend communication be extended for this?
The current spartacus version is 3.3

PrestaShop iframe payment module

I'm developing a payment gateway module for prestashop 1.6.x - 1.7.x versions and this module is iFrame. I mean, when a customer chooses this payment method then he's redirected to an iframe page in prestashop (not redirected to another web page). But I must create an order before payment on this page. If I create the order after payment is done in order-confirmation page (to this page is automatically redirected to in 5 sec by iframe after the payment is done), it's maybe not the correct way for this method. Maybe the customer has left the iframe page in these 5 secs. So, the order is not created.
When I use the validateOrder function for creating an order, it is sending an email to the customer before payment is done. So, I did some changes in this function and it's working fine. But, if this page is refreshed then the order is created over and over again. Also, the validateOrder function is deleting the cart. I duplicate the cart because of this.
I hope everything is ok here. Here are my problems;
I don't want to show duplicated orders to the customer. Maybe these orders can be updated like id_customer = 0. But in this case, the customers can not be seen in the BO order table and I don't know if is it legal.
validateOrder function is not compatible with all of these versions. How can I use this for all versions without sending an email? Actually I want to use core function but I guess there is no way.
What is the best practice in this scenario? What is the way I have to follow?

Use Product Metafields from Stencil in BigCommerce

Stencil provides access the Custom Fields of a Product in a template file as documented in Product Other Details
{{product.custom_fields}}
{{#each custom_fields}}
<li>{{name}}: {{{value}}}</li>
{{/each}}
How do I access the MetaFields that are created in the Product API
POST /catalog/products/{product_id}/metafields?
Product metafields aren't currently surfaced as a Stencil property. Their original purpose was to store metadata against the product object for backend apps (data like shipping origin for ShipperHQ), so they're available via the REST API but not exposed on the front end. If you wanted to access metafields on the frontend, you could build out middleware (using a serverless function, for example) to call the API and pipe that data to the storefront.
It would be good for us to understand your use case better though. Do you want to display metafield values in the template, or base some kind of frontend logic around their values?
While one cannot natively display product metafields in Stencil, there is an app in the Bigcommerce marketplace that allows one do to so. The app also lets one view, create, update, and delete metafields for products, categories, variants, and brands. You can export metafields and import them with a csv file. The app is not free, however, there is a 7 day free trial. This answer is to give an alternative solution to the problem mentioned.

When does a cart become an abandoned cart in Magento 2?

For a client, I am building a Magento 2 module to automatically send an abandoned cart email when certain conditions are met. I started of with testing when Magento 2 considers a cart abandoned, but simply creating a cart and leaving the page doesn't always seem to trigger the reporting process.
Does anyone have more information on this topic?
Abandoned is not magento 2 default feature.So, magento does not calculate a cart as abandoned or not.
In magento,you can access a cart until that quote/cart has been delete from Quote at table.
For quest customer, a cart is active when session is expire. So,
Implement abandoned is totally depend on your business logic.