javaspringcartsap-commerce-cloud

Why oldCartRemovalJob is placed in the <custom-name>commercewebservices?


I would like to remove old carts. Hybris has a job called oldCartRemovalJob but it is within the custom-name_commercewebservices but I do not use the "custom-name_commercewebservices" in any custom extension since commercewebservices extension is based on RESTful web services to be able to connect with Hybris platform anywhere.

What is best practice to use oldCartRemovalJob? writing it from scratch (copy-paste everything about existing job) in a platform custom extension? Or using requires-extension custom-name_commercewebservices?


Solution

  • If you don't have any custom requirement, you can use CartRemovalJob present in acceleratorservices. Simply run below Impex to configure your cleanup job. Replace myStore & mySite with your values.

    $storeUid=myStore
    $siteUid=mySite
    
    
    # Cart Cleanup CronJobs (instance of CartRemovalCronJob)  
    INSERT_UPDATE CartRemovalCronJob ; code[unique=true]      ; job(code)[default=cartRemovalJob] ; sites(uid)[default=$siteUid] ; sessionLanguage(isoCode)[default=en]
                                     ; $siteUid-CartRemovalJob
    
    # Trigger for your job
    INSERT_UPDATE Trigger ; cronJob(code)[unique=true]    ; second ; minute ; hour ; day ; month ; year ; relative ; active ; maxAcceptableDelay
                          ; $siteUid-CartRemovalJob       ; 0      ; 0      ; 5    ; -1  ; -1    ; -1   ; false    ; true   ; -1  
    

    Configure Cart removal age - You can configure cartRemoval age for logged-in customers. The default value is 28 days (2419200 seconds).

    INSERT_UPDATE BaseSite ; uid[unique=true] ; cartRemovalAge  
                           ; mySite           ; 2419200           
    

    Configure Anonymous cart removal age - As same as above, you can also configure cartRemovalAge for anonymous users. The default value is 14 days (1209600 seconds).

    INSERT_UPDATE BaseSite ; uid[unique=true] ; anonymousCartRemovalAge
                           ; mySite           ; 1209600