Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. require("app/bootstrap.php");
  4. $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
  5. $obj = $bootstrap->getObjectManager();
  6.  
  7. // Set the state (not sure if this is neccessary)
  8. $state = $obj->get('MagentoFrameworkAppState')->setAreaCode('frontend');
  9.  
  10. // Get cart items
  11. $quote = $obj->get('MagentoCheckoutModelSession')->getQuote();
  12. $quoteItems = $quote->getAllVisibleItems();
  13.  
  14. echo "Found " . count($quoteItems) . " cart items";
  15.  
  16. // Expected output:
  17. // Found 3 cart items
  18.  
  19. // Actual output:
  20. // Found 0 cart items
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement